1 Reply Latest reply on Mar 13, 2014 7:13 PM by Lynne A. Price

    XSLT transformation for Single XML Output

    tracey.orso Level 1

      I want to save a book to a single XML document. Is it correct that I can do this by adding an xslt to merge the standard framemaker entity type output ? Can I easily reconfigure the standard Save As XML to acheive this? or do I need to add a new menu item and call the XSLT dialogue...

       

      any advice appreciated.

       

       

      Thanks!

        • 1. Re: XSLT transformation for Single XML Output
          Lynne A. Price Level 4

          Tracey,

             A related discussion appeared in the FrameSGML Yahoo group recently. Much of what follows is what I wrote there.

           

             Your XML application (defined in structapps.fm or another application definition file) can specify an XSLT post-process. No need to change Save as XML or define a new menu item. Depending on what you want, the XSLT transform can be as simple as the following:

           

          <?xml version="1.0" encoding="UTF-8"?>

          <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

              <xsl:output method="xml"/>

              <xsl:template match="/ | node() | @*">

                  <xsl:copy>

                      <xsl:apply-templates select="@* | node()"/>

                  </xsl:copy>

              </xsl:template>

          </xsl:transform>

           

          This is an identity transform that simply copies the interpreted input to the output. I've used the word "interpreted" here because XSLT does not distinguish among some variations of how content is entered. In particular, it does not distinguish between content in referenced general entities (which is what you want) or between attribute values that happen to be the same as the attribute default value and attributes that are not explicitly specified and hence use the default value.

           

          There are a few things to watch out for involving use of general entities.

           

          First, if you are using entity attributes for graphics, you'll need to modify the above slightly. It's probably easier to replace the entity attributes with file attributes, but if you want to keep the entities, the above needs to be extended to declare the entities.

           

          Second, if you are using and want to preserve entity references for special characters or variables, you'll need to account for them as well. See $FMHOME\Structure\xml\PreserveEntity\readme.pdf.

           

              --Lynne