62,244
社区成员




<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/Menus">
<html>
<body>
<xsl:value-of select="Title" />
<xsl:value-of select="URL" disable-output-escaping="yes"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
写法很多,第一步
a 可以用apply template来遍历节点
b 可以用xsl:for-each来循环节点
第二步
具体处理href的显示
a,可以采用param,或variable
<xsl:param name="url" select="/Menus/URL/a/@href" />
输出时
<a href="{$url}">test</a>
b.如果循环到某个Menus下,那么可以用./来代表当前的Menus节点,写法为
<xsl:param name="url" select="./URL/a/@href" />
输出时
<a href="{$url}">test</a>
c.不采用param的写法
<a><xsl:attribute name="href"><xsl:value-of select="./URL/a/@href" /></xsl:attribute></a>
其它的我不一一列举了.