声明:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
or
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
or
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
匹配:
<xsl:template match="/">
</xsl:template> 匹配嵌套:
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="cd">
<xsl:apply-templates select="title"/> <xsl:apply-templates select="artist"/> </xsl:template>
<xsl:template match="title">
do some thing!
</xsl:template>
<xsl:template match="artist">
do some thing! </xsl:template> 从xml中取值:
<xsl:value-of select="catalog/cd/title"/>
排序:
<xsl:sort select="artist"/>//多用于循环中.eg:for-each中 条件测试1:
<xsl:if test="price > 10"> do some thing!
</xsl:if>
条件测试2:相当于if...else...
<xsl:choose> <xsl:when test="price > 10"> <td bgcolor="#ff00ff"> <xsl:value-of select="artist"/></td> </xsl:when> <xsl:otherwise> <td><xsl:value-of select="artist"/></td> </xsl:otherwise> </xsl:choose>