| Nic Miloslav Example 30 | KEYWORDS EXAMPLES AUTHORS |
|---|
An example of use of function name()
| XML | HOME XSL 1 |
|---|
| <xslTutorial > |
| <date year='1999' month='11' day='23'/> |
| <weight kg='24' g='314'/> |
| </xslTutorial> |
| XSL 1 | HOME XML HTML 1 OUTPUT 1 |
|---|
| <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' > |
| <xsl:template match="/"> |
| <TABLE> |
| <xsl:for-each select="//*[@*]"> |
| <xsl:call-template name="elementTemplate"/> |
| </xsl:for-each> |
| </TABLE> |
| </xsl:template> |
| <xsl:template name="elementTemplate"> |
| <TR><TH><xsl:value-of select="name(.)"/></TH> |
| <TD><xsl:call-template name="attributeTemplate"/></TD></TR> |
| </xsl:template> |
| <xsl:template name="attributeTemplate"> |
| <xsl:for-each select="@*"> |
| <xsl:value-of select="name()"/> |
| <xsl:text> =</xsl:text> |
| <xsl:value-of select="."/> |
| <xsl:text> </xsl:text> |
| </xsl:for-each> |
| </xsl:template> |
| </xsl:stylesheet> |
| HTML 1 | HOME XML XSL 1 OUTPUT 1 |
|---|
| <HTML> |
| <HEAD> </HEAD> |
| <BODY> |
| <TABLE> |
| <TR> |
| <TH>date</TH> |
| <TD>year=1999 month=11 day=23 </TD></TR> |
| <TR> |
| <TH>weight</TH> |
| <TD>kg=24 g=314 </TD></TR></TABLE> </BODY> </HTML> |
| OUTPUT 1 | HOME XML XSL 1 HTML 1 |
|---|
| date | year=1999 month=11 day=23 |
|---|---|
| weight | kg=24 g=314 |