Élément de XSl
|
Le xsl : l'élément produit des éléments dedans à la période du traitement.
|
XML source
<?xml version="1.0"?>
<xslTutorial >
<text size="H1">Header1</text>
<text size="H3">Header3</text>
<text size="b">Bold text</text>
<text size="sub">Subscript</text>
<text size="sup">Superscript</text>
</xslTutorial>
|
HTML output 1
<HTML>
<HEAD> </HEAD>
<BODY>
<H1>Header1</H1>
<H3>Header3</H3>
<b>Bold text</b>
<sub>Subscript</sub>
<sup>Superscript</sup>
</BODY>
</HTML>
|
|
XSL stylesheet 1
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="/">
<xsl:for-each select="//text">
<xsl:element name="{@size}"><xsl:value-of select="."/></xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
|
|
L'attribut de XSL
|
Le xsl : l'attribut produit des éléments dans la période du traitement. Il crée l'attribut dans l'élément dans lequel il est enfermé.
|
XML source
<?xml version="1.0"?>
<xslTutorial >
<color>blue</color>
<color>navy</color>
<color>green</color>
<color>lime</color>
<color>red</color>
|
HTML output 1
<HTML>
<HEAD> </HEAD>
<BODY>
<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>
</BODY>
</HTML>
|
|
XSL stylesheet 1
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="color">
<TABLE>
<TR><TD>
<xsl:attribute name="style">
color:<xsl:value-of select="."/>
</xsl:attribute>
<xsl:value-of select="."/>
</TD></TR>
</TABLE>
</xsl:template>
</xsl:stylesheet>
|
|
Le copy et le Copy-de Constructs
|
Le copy et copie-des constructions sont employés pour copier de noeuds. L'élément de copy copie en bas seulement du noeud courant sans enfants et attributs, tandis que copie-de faire les copies tout.
|
XML source
<?xml version="1.0"?>
<xslTutorial >
<p id="a12">
Compare <B>these constructs</B>
</p>
</xslTutorial>
|
HTML output 1
<HTML>
<HEAD> </HEAD>
<BODY>
<DIV>
<B>copy-of : </B>
<p id="a12"> Compare
<B>these constructs</B>. </p></DIV>
<DIV>
<B>copy : </B>
<p/></DIV>
<DIV>
<B>value-of : </B> Compare these constructs.
</DIV>
</BODY>
</HTML>
|
|
XSL stylesheet 1
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:template match="p">
<DIV><B><xsl:text> copy-of : </xsl:text> </B> ;
<xsl:copy-of select="."/>
</DIV>
<DIV><B><xsl:text> copy : </xsl:text> </B>
<xsl:copy/ >
</DIV>
<DIV><B><xsl:text> value-of : </xsl:text> </B>
<xsl:value-of select="."/>
</DIV>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
Keywords XSL Elements, xsl element, xslt element, the stylesheet does not contain a document element,
xsd element, stylesheet does not contain a document element, cdata section elements,
xpath element, xsd elements, cdata element, xslt elements, xsl element name, xsd optional element,
xsl for each, stylesheet element, xsl value of, asp net xsl, xsl select element, xml elements,
element in xslt
|