【发布时间】:2015-08-31 10:46:20
【问题描述】:
我正在尝试通过使用 xsl 将 xml 转换为文本格式,但我得到了输出,但有些 dono 来调整值
xml:
<xx>
<yy id="1">
<aa value="1"/>
</yy>
<yy id="2">
<aa value="1"/>
</yy>
<yy id="3">
<aa value="11"/>
</yy>
</xx>
xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:text>Id</xsl:text><xsl:text> </xsl:text>Number
<xsl:for-each select="xx/yy">
<xsl:apply-templates select="@id"/><xsl:text> </xsl:text>
</xsl:for-each>
<xsl:for-each select="xx/yy/aa">
<xsl:apply-templates select="@value"/><xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
输出是:
id number
1
2
3
1 1 11
但希望是
id number
1 1
2 1
3 11
我是 xslt 新手,如何实现这种格式
【问题讨论】: