Nic Miloslav     Example 17    KEYWORDS      EXAMPLES      AUTHORS     

xsl:attribute generates elements in time of processing. It creates attribute in the element in which it is enclosed.


     XML     HOME     XSL 1      
<xslTutorial >
<color>blue</color>
<color>navy</color>
<color>green</color>
<color>lime</color>
<color>red</color>
</xslTutorial>

     XSL 1     HOME     XML     HTML 1     OUTPUT 1     
<xsl:stylesheet version='1.0' 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>

     HTML 1     HOME     XML     XSL 1     OUTPUT 1     
<HTML>
<HEAD> </HEAD>
<BODY>
<TABLE>
<TR>
<TD style="&#10;color:blue">blue</TD></TR></TABLE>
<TABLE>
<TR>
<TD style="&#10;color:navy">navy</TD></TR></TABLE>
<TABLE>
<TR>
<TD style="&#10;color:green">green</TD></TR></TABLE>
<TABLE>
<TR>
<TD style="&#10;color:lime">lime</TD></TR></TABLE>
<TABLE>
<TR>
<TD style="&#10;color:red">red</TD></TR></TABLE> </BODY> </HTML>

     OUTPUT 1     HOME     XML     XSL 1     HTML 1     
blue
navy
green
lime
red