我不知道如何保存包含 XML 表的输出转义元素并对该 XML 表进行转换。我似乎无法访问转义元素的节点。
这是 XML:
<TABEL_HUIDIGE_SITUATIE><ELEMNEW_TABEL Type="4912"><Table><TableRow RowId="0"><TC Bold="true">Nr.</TC><TC Bold="true">Omschrijving</TC><TC Bold="true">Bedrag</TC><TC Bold="true">BTW-productboekingsgroep</TC><TC Bold="true">Bedrag Incl BTW</TC></TableRow><TableRow RowId="1"><TC Type="31488">010</TC><TC Type="31488">Antenne BTW</TC><TC Type="12799">12.021,55</TC><TC Type="31489">21% INT</TC><TC Type="31488">14.546,08</TC></TableRow></Table></ELEMNEW_TABEL>
</TABEL_HUIDIGE_SITUATIE>
未转义的 XML 将如下所示:
<?xml version="1.0" encoding="UTF-8"?><ELEMNEW_TABEL Type="4912"><Table><TableRow RowId="0"><TC Bold="true">Nr.</TC><TC Bold="true">Omschrijving</TC><TC Bold="true">Bedrag</TC><TC Bold="true">BTW-productboekingsgroep</TC><TC Bold="true">Bedrag Incl BTW</TC></TableRow><TableRow RowId="1"><TC Type="31488">010</TC><TC Type="31488">Antenne BTW</TC><TC Type="12799">12.021,55</TC><TC Type="31489">21% INT</TC><TC Type="31488">14.546,08</TC></TableRow></Table></ELEMNEW_TABEL>
这是 XSL:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:exsl="http://exslt.org/common" exclude-result-prefixes="exsl">
<xsl:template name="box2">
<xsl:param name="rtf"/>
<xsl:apply-templates select="exsl:node-set($rtf)/node()" mode="doe"/>
</xsl:template>
<xsl:template match="text()" mode="doe">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:template>
<xsl:template match="*" mode="doe">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="/">
<xsl:call-template name="box2">
<xsl:with-param name="rtf">
<xsl:value-of select="." />
</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:transform>
我不知道输出的转义内容是否被识别为XML或字符串。我无法在
尝试了不同的方法来访问节点但没有结果。
parse-xml()
函数,该函数将返回已解析的 XML,您可以在 XSLT 中使用 XPath。