【发布时间】:2014-05-08 19:22:25
【问题描述】:
我有以下 XML:<a>Text with <b>stuff</b> here</a>
使用我的代码:
<xsl:template match="*[local-name() = 'a'][namespace-uri()=namespace-uri(.)]">
<xsl:value-of select="normalize-space(text()) "/><xsl:text> </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="*[local-name() = 'b'][namespace-uri()=namespace-uri(.)]">
<xsl:value-of select="normalize-space(text())"/><xsl:text> </xsl:text>
<xsl:apply-templates/>
</xsl:template>
我只得到结果:
文字内容
我想要的是:
这里有东西的文字。
那么我该如何处理<b/>元素之后的剩余文本呢?
【问题讨论】:
-
查看更多样式表会很有帮助。当我只应用这些模板时,我会得到不同的输出。它产生
Text with Text with stuff stuff here