当然,这是可能的。只需使用身份转换并专门处理<break>
。除了使用<xsl:copy>
复制它的输出任何文本你喜欢:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="break">
<xsl:value-of select="' '"/>
</xsl:template>
</xsl:stylesheet>
你想要的文字输出
你可以使用disable-output-escaping
,像
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="break">
<xsl:value-of select="'&#10;'" disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
不过我,这是一项可选功能,并且不保证得到任何XSLT处理器的支持。
你是我的朋友的传奇人物。 – Dono