这是我的xml文档。我想用xslt2.0将它转换成另一种xml格式。与xslt 2.0中的每一个碰撞?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:v="urn:schemas-microsoft-com:vml">
<w:body>
<w:tbl/>
<w:tbl/>
</w:body>
</w:document>
这是我的xslt 2.0代码snippt。
<xsl:for-each select="following::node()[1]">
<xsl:choose>
<xsl:when test="self::w:tbl and (parent::w:body)">
<xsl:apply-templates select="self::w:tbl"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:template match="w:tbl">
<table>
table data
</table>
</xsl:template>
我生成的输出是:
<table>
table data
<table>
table data
</table>
</table>
但我所需的输出是:
<table>
table data
</table>
<table>
table data
</table>
你真的有使用这些“前,每个”功能?这在选择“follow :: node”等时非常难看...... – FiveO