|
|
Attributs de XSL
|
Des attributs peuvent �tre acc�d�s de la mani�re semblable aux �l�ments. Notification @ devant le nom d'attribut.
|
XML source
<?xml version="1.0"?>
<xslTutorial >
<dog name='Joe'>
<data weight='18 kg' color="black"/>
</dog>
</xslTutorial>
|
HTML output 1
<HTML>
<HEAD> </HEAD>
<BODY>
<P>
<B>Dog: </B>Joe</P>
<P>
<B>Color: </B>black</P>
</BODY>
</HTML>
|
|
XSL stylesheet 1
<xsl:stylesheet 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>
|
|
Vous pouvez faire le processus l'attribut d'une m�me mani�re que l'�l�ment
|
Vous pouvez �galement choisir les �l�ments, qui contiennent ou pas contiennent un attribut donn�.
|
XML source
<?xml version="1.0"?>
<xslTutorial >
<car id='a234' checked='yes' />
<car id='a111' checked='yes' />
<car id='a005' />
</xslTutorial>
|
HTML output 1
<HTML>
<HEAD> </HEAD>
<BODY>
<P>Car: a234</P>
<P>Car: a111</P>
</BODY>
</HTML>
|
HTML output 2
<HTML>
<HEAD> </HEAD>
<BODY>
<P>Car: a005</P>
</BODY>
</HTML>
|
|
XSL stylesheet 1
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="car[@checked]">
<P><xsl:text> Car: </xsl:text>
<xsl:value-of select="@id"/></P>
</xsl:template>
</xsl:stylesheet>
|
XSL stylesheet 2
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="car[not(@checked)]">
<P><xsl:text> Car: </xsl:text>
<xsl:value-of select="@id"/></P>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
Keywords XSL Attributes, xpath attributes, xsd attributes, xslt attributes, xsl for each,
stylesheet attributes, xsl value of, attributes xsl, xsl copy attributes, asp net xsl,
attributes in xsl, asp net attributes, xml attributes, display xsl, text attributes,
display attributes, value xsl, parse attributes, attributes examples, xsl using,
xsl generate, using attributes, convert xsl, xml attribute, xsl multiple, tag attributes,
xsl attribute, xslt attribute,
|