xslt - 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
。
问题:
- 我可以在 InDesign 中使用节点集功能吗?
- 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>
推荐阅读
- javascript - 如何使用javascript设置默认链接?
- android - 在 MainActivity 中为 RecyclerView 中存储的联系人实现 searcView
- npm - 如何在代理后面使用 npm 安装文件?
- php - 在codeigniter中从模型接收数组到控制器
- php - 无法从一个 php paganother 获取会话信息
- python - 为什么 Python IDLE 比 Spyder 或 Jupyter notebook 快
- c# - Request.IsHttps 和 Request.Scheme 显示请求是 HTTP 而不是 HTTPS
- android - xamarin 表单 svg 文件显示在 android 模拟器上,但不在移动设备 htc 一 m9 android 7 中
- android - 使用 API 26 打开 Delphi Android 文件失败
- javascript - 与文件链接时,javascript无法正常工作,但当我将代码粘贴到控制台时,javascript可以正常工作