我有这个 XSLT 样式表:
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:character-map name="cm">
<xsl:output-character character="1" string="abc"/>
<xsl:output-character character="2" string="def"/>
<xsl:output-character character="3" string='ghi'/>
</xsl:character-map>
<xsl:template match="/">
123abc
<abc att="123abc"/>
<xsl:value-of select="'123abc'"/>
</xsl:template>
</xsl:stylesheet>
无论我如何尝试,字符映射似乎都不起作用。有人可以告诉我如何让它工作吗?我错过了什么吗?
最佳答案
您已经定义了一个字符映射表,但您没有使用它。尝试:
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:character-map name="cm">
<xsl:output-character character="1" string="abc"/>
<xsl:output-character character="2" string="def"/>
<xsl:output-character character="3" string='ghi'/>
</xsl:character-map>
<xsl:output use-character-maps="cm" />
<xsl:template match="/">
123abc
<abc att="123abc"/>
<xsl:value-of select="'123abc'"/>
</xsl:template>
</xsl:stylesheet>
关于xml - 如何在 XSLT 中使用字符映射?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25830205/