Elemento di XSl
|
Il xsl: l'elemento genera gli elementi dentro a periodo di elaborazione.
|
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'attributo di XSL
|
Il xsl: l'attributo genera gli elementi nel periodo di elaborazione. Genera l'attributo nell'elemento in cui � accluso.
|
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>
|
|
Il copy ed il Copy-de Constructs
|
Il copy e copia-delle costruzioni � usato per la copiatura di nodi. L'elemento del copy copia gi� soltanto il nodo corrente senza i bambini e gli attributi, mentre copia-di fare le copie tutto.
|
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
|