如何在使 xslt 浏览文件时处理 xml 中的命名实体 (*)?

How to handle named entity (*) in xml while make xslt to browse file?

xml 文件:

这里是实体“*

期望输出:

这是实体“*

您必须声明实体:

<!DOCTYPE para [
<!ENTITY ast "*">
]>
<para>here is entity "&ast;" </para>

XSLT 代码简单地将 para 转换为 p 元素:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">

    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* , node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="para">
        <p>
            <xsl:apply-templates select="@* , node()"/>
        </p>
    </xsl:template>
</xsl:stylesheet>