【发布时间】:2018-04-18 07:14:51
【问题描述】:
我正在为处理文件列表的 XSL 苦苦挣扎。对于大多数文件,该函数可以正常工作,但是当文件名包含 % 符号时它会崩溃。
这是我的 XSLT:
<xsl:template match="file">
<xsl:variable name="sourcedoc" select="concat('file:///', text())"/>
<madcapfile>
<xsl:attribute name="filename"><xsl:value-of select="text()"/></xsl:attribute>
<xsl:apply-templates select="document($sourcedoc)"/>
</madcapfile>
</xsl:template>
和我的带有文件列表的 XML:
<file>the 7% solution.xml</file>
在 Saxon 中处理此问题时,它抱怨找不到文件 "7olution.xml"
XLST 将其指定为输出:
<xsl:output method="xml" escape-uri-attributes="no" />
感谢 escape-uri-attributes="no",URI 在转换后的 XML 中正确显示。我一直无法找到适用于 document() 的等效函数。 如何确保 document() 将 % 视为文字而不是转换它?
【问题讨论】: