Xml 在子元素之前和之后输出节点的内容
我有以下xml文件:Xml 在子元素之前和之后输出节点的内容,xml,xslt,xslt-2.0,xsl-fo,Xml,Xslt,Xslt 2.0,Xsl Fo,我有以下xml文件: <parent> Hello <child>10</child> <child>20</child> <child>30</child Italic <child>400</child> <child>500</child> Bold </parent> 你好 10 20 30只要
<parent> Hello
<child>10</child>
<child>20</child>
<child>30</child
Italic
<child>400</child>
<child>500</child>
Bold
</parent>
你好
10
20
30只要您使用
应用模板
来处理子节点,其余的就可以了,所以更改
<xsl:template match="parent">
<fo:block>
<xsl:value-of select="text()"/>
<xsl:apply-templates select="child"/>
</fo:block>
</xsl:template>
<xsl:template match="child">
<fo:inline>
<fo:inline color="Red"><xsl:value-of select="child"/></fo:inline>
</fo:inline>
</xsl:template>
到
请您发布您的预期输出。。。。以及您得到的输出。
<xsl:template match="parent">
<fo:block>
<xsl:value-of select="text()"/>
<xsl:apply-templates select="child"/>
</fo:block>
</xsl:template>
<xsl:template match="child">
<fo:inline>
<fo:inline color="Red"><xsl:value-of select="child"/></fo:inline>
</fo:inline>
</xsl:template>
<xsl:template match="parent">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="child">
<fo:inline>
<fo:inline color="Red">
<xsl:apply-templates/>
</fo:inline>
</fo:inline>
</xsl:template>