>> English << | Français | Deutsch | Magyar | 中文 | Polski | ZVON > Tutorials > XSLT Tutorial |
Intro / Search / ZVON |
>> Page 12 << | Prev | Next | Contents | Element Index |
XML Source
<source> <dog name="Joe"> <data weight="18 kg" color="black"/> </dog> </source> Output
<p> <b>Dog: </b>Joe</p> <p> <b>Color: </b>black</p> HTML view
Dog: Joe Color: black |
XSLT stylesheet
<xsl:stylesheet version = '1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:template match="dog"> <p> <b> <xsl:text>Dog: </xsl:text> </b> <xsl:value-of select="@name"/> </p> <p> <b> <xsl:text>Color: </xsl:text> </b> <xsl:value-of select="data/@color"/> </p> </xsl:template> </xsl:stylesheet> |