3
XML:XSLT选择文本没有孩子
<data><ph>Foo</ph>Bar</data>
XSL:
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="data/ph"/>
<xsl:apply-templates select="data"/>
</xsl:template>
<xsl:template match="data/ph">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="data">
<xsl:value-of select="."/>
</xsl:template>
当XSL在/数据选择文本/与<xsl:template match="data"><xsl:value-of select="."/>
它也是孩子选择文本实体数据/ ph。我如何仅指向/ data /的文本,而不包括/ data/ph /的文本?
我的输出应该是:FooBar,而不是FooFooBar。
完美,所以我重写它为: 的 的 的 xsl:template> –
@ user1848612,欢迎您。 –