>> English << | Français | Deutsch | Magyar | 中文 | Polski | ZVON > Tutorials > XSLT Tutorial |
Intro / Search / ZVON |
>> Page 23 << | Prev | Next | Contents | Element Index |
XML Source
<source> <color>blue</color> <color>navy</color> <color>green</color> <color>lime</color> <color>red</color> </source> Output
<TABLE> <TR> <TD style="color:blue">blue</TD> </TR> </TABLE> <TABLE> <TR> <TD style="color:navy">navy</TD> </TR> </TABLE> <TABLE> <TR> <TD style="color:green">green</TD> </TR> </TABLE> <TABLE> <TR> <TD style="color:lime">lime</TD> </TR> </TABLE> <TABLE> <TR> <TD style="color:red">red</TD> </TR> </TABLE> HTML view
|
XSLT stylesheet
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match="color"> <TABLE> <TR> <TD> <xsl:attribute name="style"> <xsl:text>color:</xsl:text> <xsl:value-of select="."/> </xsl:attribute> <xsl:value-of select="."/> </TD> </TR> </TABLE> </xsl:template> </xsl:stylesheet> |