微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

InDesign 中的 XSLT node-set() 函数支持

如何解决InDesign 中的 XSLT node-set() 函数支持

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

当我选择文件 -> 导入 XML... 时,选择 XML,然后应用 XSLT -> 浏览器...并选择 xslt,单击确定 - 我收到错误 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 处理器?

解决方法

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>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。