2 Replies Latest reply on Jul 7, 2011 10:15 AM by James Robinson

    Hide or Import Original XML?

    James Robinson Level 1

      I have an original XML file that is being imported into InDesign and transformed with XSL and I want the original structure to be included (it is required for export and re-ingestion into a CMS) but I want to only show the XSL transformed data while retaining the original XML. Is there a way to hide XML tags or reimport the orginal XML file at export (maybe scripting?) in InDesign?


      As an example, I have an XML file that looks like this (actual XML will contain many more fields, this is an example):




      <name>Title of object</name>

      <description>A description</description>

      <extraTag1>Some extra tag not needed in InDesign but required for re-importing</extraTag1>

      <extraTag2>Some extra tag not needed in InDesign but required for re-importing</extraTag2>


      <Content>Some body text required</Content>


      <relatedObject id="234" />

      <relatedObject id="244" />





      that will be transformed into something like this (with an XSL file on import):




      <title1>Title of object&#13;<title2>A description</title2></title1>

      {* Combination of name and description tags from original XML above *}

      <body>Some body text required</body>

      {* Pulled from Content/Content path of original XML above *}



      When I export the XML data from InDesign I need the original XML structure to be exported (using the data above re-mapped to the original structure). That is why I need to know if there is a way to hide tags (so I would stuff the original XML into a hidden tag that would be ignored by InDesign except for export). Or perhaps is there a way, programattically or does InDesign pass parameters to the XSL file, that allow for importing the original XML file on export through JavaScript or XSL?


      Put simply, I either need to hide the orginal XML in the transformed XML upon import or be able to have a path to the original XML passed to the export XSL file so I can restructure the data the way it came in... any ideas?

        • 1. Re: Hide or Import Original XML?

          You don't say whether you intend to make changes to the XML that's imported into InDesign. Presumably you are, otherwise there's no need to get it back out, correct?


          If you are doing an XSLT transform on the XML imported into InDesign, you'll have to do the "reverse" transformation via XSLT on export. This unless you aren't modifying the XML data in any way.


          "Hiding" isn't possible because two XML entities can't refer to the same InDesign element. Importing both the transformed and original XML is useless for the same reason: InDesign will update one but not the other.


          Are you certain that you need to transform the XML to use it in InDesign?


          HTH, Charles

          1 person found this helpful
          • 2. Re: Hide or Import Original XML?
            James Robinson Level 1

            Yes, I need to use a modified version of the XML because the original is too combersom for editors to figure out what is going on.


            So far I have an XSL file transforming the original XML, altering a few tag names, combining a few others, and stripping out the majority of the fields since they are not required.


            I will still need to have the original XML file on export which leavea a couple of other questions (I believe to do more with scripting) which I will ask in a separate post.


            Thanks vze