XSL stylesheet 12<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' > |
| <xsl:template match="/"> |
| <TABLE border="1" cellpadding = "6"> |
| <TR><TH colspan="2">Axis: descendant-or-self</TH></TR> |
| <TR><TH>Element</TH><TH>Node-set</TH></TR> |
| <xsl:for-each select="/xslTutorial//*"> |
| <xsl:call-template name="print"/> |
| </xsl:for-each> |
| </TABLE> |
| </xsl:template> |
| <xsl:template name="print"> |
| <TR> |
| <TD> |
| <xsl:value-of select="name()"/> |
| <xsl:text> id = </xsl:text> |
| <xsl:value-of select="./@id"/> |
| </TD><TD> |
| <xsl:for-each select="descendant-or-self::*"> |
| <xsl:if test="not(@id)"> |
| <xsl:value-of select="name()"/> |
| </xsl:if> |
| <xsl:value-of select="./@id"/> |
| <xsl:text> </xsl:text> |
| </xsl:for-each> |
| </TD> |
| </TR> |
| </xsl:template> |
| </xsl:stylesheet> |