Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

XML Processing Instruction Through XSL

Return to Member Forum

  • Author
    Posts
    • #71994

      Adding a processing instruction of <?whitespace-handling use-tags?> at top of my xml in order to use <aid:br/> and <aid:tab/> to deal with indesign whitespace import, works fine… but what if I want to process the xml through an xsl on import… Processing instruction doesn’t show up in InDesign at all and thus don’t work.

      Instruction is added this way, and when viewed in browser show at the right spot.

      <xsl:template match=”/”>
      <xsl:processing-instruction name=”whitespace-handling”>use-tags</xsl:processing-instruction>
      <Root xmlns:aid=”https://ns.adobe.com/AdobeInDesign/3.0/”&gt;
      <item>
      <xsl:copy-of select=”itemName” /><aid:br/>
      <xsl:copy-of select=”itemDescription” /><aid:br/>
      <xsl:copy-of select=”itemMaterial” /><aid:br/>
      <xsl:copy-of select=”itemDepth” /><aid:br/>
      <xsl:copy-of select=”itemWidth” /><aid:br/>
      </item>
      </Root>
      </xsl:template>

      What does make InDesign ignore the Instruction completely if it is added through xsl ??

    • #71995
      Allan Shearer
      Participant

      Hi Sebastian

      I too have tried getting ID to process certain XSLT instructions which I soon found out it ignored (or … there’s always a chance that I did it wrong).

      I’ve learned NOT to trust the “Apply XSLT” when Importing XML and I simply re-process the XML using a tool such as Oxygen (for a visual process), or once you get your XSLT refined to a perfect science, then, you could use a command line process such as Saxon.

      I’ve just found that if I leave it to ID (or, other apps for that matter – e.g., when Exporting out of FileMaker) to ‘apply XLST’, I’m never happy with the results. It’s very much a gamble, as we don’t really know what parsing engine ID is using (do we? – ok, perhaps *I* don’t know…). Thus … when I use a tool such as Oxygen, I can choose which parsing engine I want to use (I chose Saxon) and then I can test and see the results. If happy, then I toss everything at Saxon via the command line and end up with XML that I know has all the refinements I want.

      Not sure if this helps at all. Hope it does.

      Yours,

      Allan

    • #72002

      Thanks Allan for your feedback,
      I’m starting not to trust most of the xml import feature keeping them all unchecked if possible and rely only on what can be scripted in the incoming xml. Are there any hidden gems in the adobe namespace that nobody is aware of ? I’m using aid: from ID3.0 for aid:br an aid:tab, aid: from ID4.0 for aid:pstyle an aid:cstyle, and aid5: form ID5.0 for table stuff… but then I find really strange that there are no way of telling ID what size an anchored image should be for example.

    • #72004
      Allan Shearer
      Participant

      I initially went down the path of trying to Import XML . . . but in the end, I found I could achieve a lot more if I simply (ahem … to use that word loosely) transformed my XML into something that I could ‘drop’ into place inside an IDML file. And this is how I’ve built the two books for my Australia client. Essentially: writing the entire file with anchored images, index markers, etc. outside InDesign, and then simply (to use that word literally!) double-click on the IDML file to reveal all the hard work is done!

      I’m *sure* XML works really, really well in InDesign. But what I was trying to get it to do … either I’m not ready to learn what InDesign expects, or, InDesign isn’t ready for what I expect. So … we came to a compromise. :)

      Allan

    • #72009
      David Blatner
      Keymaster

      I have heard that several aspects of InDesign’s XML import (and output) are half-baked and really must be scripted and massaged. I know in some cases people build their own custom XML import using plug-ins and scripts.

      There are InDesign XML experts out there, such as Andrej:
      https://creativepro.com/formatting-text-xml-indesign.php

      and Claudio:
      https://www.slideshare.net/mclaud/ignite-id-pepcon-2014

      and the folks at Premedia:
      https://www.premediasystems.com/Scripts.htm

    • #72972
      David Blatner
      Keymaster

      Actually, to follow up: I just noticed that this page in the XML docs says “InDesign user-created processing instructions are meant for use in other programs; InDesign itself does not act on processing instructions.”

      https://helpx.adobe.com/indesign/using/structuring-documents-xml.html#add_comments_and_processing_instructions

    • #72975

      I think that in this snippet the key word is “InDesign user-created”. I believe it is true that once the xml is in InDesign it will not bother with processing instruction, comments, and even attribute, by itself… even more if they are added within InDesign.

      On the other side, one thing I’m sure of is that no matter what is written in the docs, InDesign will obey to the <?whitespace-handling use-tags?> processing instruction when importing an xml file if it’s hard written in it. I’m using it in combination to <aid:br/> and <aid:tab/> and the “xmlns:aid=”https://ns.adobe.com/AdobeInDesign/3.0/&#8221; namespace and it work just find ignoring the paragraph return between tags.

      As said in the opening comment, it doesn’t work through XSL at import though.

    • #72989

      Just because I’m still having this in my head,

      I found something better then using the use-tags processing instruction for what I wanted to achieve and maybe that will help someone trying to figure out the same. InDesign can import (some) Unicode Hex entities in the xml file, so (without space) &#xA ; does a Paragraph Return, &#x9 ; does a Tab, and & #x2028 ; is a Soft return. No namespace required, and no post-handling done by InDesign that takes forever after import.

      That is useful also if you need to had a soft return in many xml element but don’t want to break them in InDesign manually after import.

Viewing 7 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads