考虑以下示例:
XML:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="03-01.xsl"?>
<ancient_wonders>
<wonder myattribute = "Green">
<name language="English">Colossus of Rhodes1</name>
</wonder>
<wonder myattribute = "Red">
<name language="English">Colossus of Rhode2s</name>
</wonder>
</ancient_wonders>
XSL:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<!-- Output Method -->
<xsl:output method="html"/>
<!-- Root Template -->
<xsl:template match="/">
<html>
<body>
<p>Output 1 </p>
<xsl:for-each select="//name//*">
<xsl:value-of select = "."/>
</xsl:for-each>
<p>Output 2</p>
<xsl:for-each select="//name/@*">
<xsl:value-of select = "."/>
</xsl:for-each>
<p>Output 3</p>
<xsl:for-each select="//name/*">
<xsl:value-of select = "."/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
(你可以在这里看到输出)
现在,我们看到name有属性language
Now 在这种情况下,节点是language节点的子name节点吗?如果是,为什么我无法在输出中看到(上面的链接)?