0
我有包含在各种各样的地方下面的文档中的下列片段大而复杂的文档展开元素与XSLT
<a>foo<b>bar</b><a>
<a>foo<b>bar</b><b>hello</b><a>
,我想转换到
<b>foobar<b>
<b>foobar<b><b>hello</b>
我有包含在各种各样的地方下面的文档中的下列片段大而复杂的文档展开元素与XSLT
<a>foo<b>bar</b><a>
<a>foo<b>bar</b><b>hello</b><a>
,我想转换到
<b>foobar<b>
<b>foobar<b><b>hello</b>
使用以下两种模板匹配器:
<xsl:template match="a">
<xsl:apply-templates select="b"/>
</xsl:template>
<xsl:template match="b">
<xsl:copy>
<xsl:if test="position() = 1">
<xsl:value-of select="parent::a/text()"/>
</xsl:if>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:template>