0

I have xslt 1.0 module with ext:node-set function (xmlns:ext="http://exslt.org/common") and would like to use it in InDesign's CC (2014) via Import XML... feature.

When I choose File -> Import XML..., select XML, then Apply XSLT -> Browser... and choose xslt, click OK - I get an error Function 'ext:node-set' not supported.

I've tried to replace a namespace to xmlns:xalan="http://xml.apache.org/xalan" and function call xalan:nodeset - the similar error Function 'xalan:nodeset' not supported.

Questions:

  1. Can I use node-set function in InDesign?
  2. Which xslt processor is using in InDesign?
  • 2
    Re your 2nd question, see: https://stackoverflow.com/a/25245033/3016153 – michael.hor257k Apr 12 '21 at 21:07
  • 2
    Re your 1st question, you can use ``. – michael.hor257k Apr 12 '21 at 21:12
  • 1
    When I run Michael's code I am getting "Ginger Alliance" which means Sablotron and it should support exsl functions. Try to search on Sablotron specific usage as it looks like it is different from the other processors – Nicolai Kant Apr 13 '21 at 01:05
  • 2
    I don't remember details of the Sablotron XSLT processor but an old article https://www.xml.com/pub/a/2003/07/16/nodeset.html suggests that, contrary to most other XSLT 1.0 processors, it simply allowed you to use XPath on result tree fragments without any need for a `node-set` extension function. So perhaps give that a try and simply try to run the code omitting the call(s) to the extension function. – Martin Honnen Apr 13 '21 at 08:03
  • @MartinHonnen thank you. Yes, you are right, no need to use extension function. It's working now. – Alexander Dyuzhev Apr 13 '21 at 08:28

1 Answers1

0

Sablotron processor by Ginger Alliance is using in InDesign. Ginger Alliance site available via Wayback Machine https://web.archive.org/web/20090430034418/http://www.gingerall.org/index.html. Regarding https://www.xml.com/pub/a/2003/07/16/nodeset.html#tab.namespaces, Sablotron Can operate on result tree fragments directly, i.e. no need to use node-set or nodeset functions.

Example:

<xsl:variable name="items">
  <item>1</item>
  <item>2</item>
  <item>3</item>
</xsl:variable>
<xsl:choose>
  <xsl:when test="function-available('ext:node-set')"> <!-- for EXSLT compatible processor -->
    <xsl:for-each select="ext:node-set($items)//item">
      <xsl:value-of select="."/>
    </xsl:for-each>
  </xsl:when>
  <xsl:otherwise> <!-- for InDesign -->
    <xsl:for-each select="$items//item">
      <xsl:value-of select="."/>
    </xsl:for-each>
  </xsl:otherwise>
</xsl:choose>