首页 > 解决方案 > InDesign 中的 XSLT node-set() 函数支持

问题描述

我有带有ext:node-set功能 ( xmlns:ext="http://exslt.org/common") 的 xslt 1.0 模块,并希望通过Import XML...功能在 InDesign 的 CC (2014) 中使用它。

当我选择 File -> Import XML... 时,选择 XML,然后 Apply XSLT -> Browser... 并选择 xslt,单击 OK - 我得到一个错误Function 'ext:node-set' not supported

我试图将命名空间替换为xmlns:xalan="http://xml.apache.org/xalan"函数调用xalan:nodeset- 类似的错误Function 'xalan:nodeset' not supported

问题:

  1. 我可以在 InDesign 中使用节点集功能吗?
  2. InDesign 中使用的是哪个 xslt 处理器?

标签: xsltadobe-indesign

解决方案


Ginger Alliance 的 Sablotron 处理器正在 InDesign 中使用。Ginger Alliance 网站可通过 Wayback Machine https://web.archive.org/web/20090430034418/http://www.gingerall.org/index.html获得。关于https://www.xml.com/pub/a/2003/07/16/nodeset.html#tab.namespaces, Sablotron Can operate on result tree fragments directly,即不需要使用节点集或节点集功能。

例子:

<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>

推荐阅读