Elemento de XSl
|
O xsl: o elemento gera os elementos dentro na época de processar.
|
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>
|
|
O atributo de XSL
|
O xsl: o atributo gera os elementos na época de processar. Cría o atributo no elemento em que é incluído.
|
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>
|
|
O copy e Copy-das construções
|
O copy e cópia-das construções é usado para o copi dos nós. O elemento do copy copía abaixo somente o nó atual sem as crianças e os atributos, quando cópia-de fazer cópias tudo.
|
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
|