Subject: xsl:attribute-set and xsl:use-attribute-sets From: "Larry Mason" <Larry_Mason@xxxxxx> Date: Fri, 20 Aug 1999 08:11:57 -0500 |
Can anyone find the flaw in the code below? I can't seem to get the attribute set to work at all. As you can see I'm trying several combinations but none work. Also, how complicated can the setting of the actual attributes be? For example, if I wanted to set the BGCOLOR based on position of the 'row', can I simply put that logic within the definition of the attributes or must attribute values inside a set be constant? I used to do this in a named template but I think this approach is cleaner (once it works !). I'm using XT versions April and August if that matters. Thanks in advance, Larry Mason i2 Technologies XML <data> <row> <column>1</column> <column>2</column> <column>3</column> </row> <row> <column>4</column> <column>5</column> <column>6</column> </row> </data> XSL <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0" xmlns:"http://www.w3.org/TR/REC-html40" result-ns=""> <xsl:attribute-set name="tablerow"> <xsl:attribute name="bgcolor">red</xsl:attribute> </xsl:attribute-set> <xsl:template match="data"> <xsl:apply-templates /> </xsl:template> <xsl:template match="row"> <TR xsl:use-attribute-sets="tablerow"> <TR use-attribute-sets="tablerow"> <xsl:element name="TR" xsl:use-attribute-sets="tablerow"> <xsl:element name="TR" use-attribute-sets="tablerow"> <xsl:apply-templates> </xsl:element> </xsl:element> </TR> </TR> </xsl:template> <xsl:template match="column"> cell #<xsl:value-of select="position()"/>=<xsl:value-of select="."/> </xsl:template> </xsl:stylesheet> RESULT <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <TR use-attribute-sets="tablerow"> <TR use-attribute-sets="tablerow"> <TR> <TR> cell #1=1 cell #2=2</TR> </TR> </TR> </TR> <TR use-attribute-sets="tablerow"> <TR use-attribute-sets="tablerow"> <TR> <TR> cell #1=4 cell #2=5</TR> </TR> </TR> </TR> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: No duplicate, James Tauber | Thread | RE: attribute-set and xsl:use-attri, Harbarth, Juliane |
No duplicate, Henrik Andersson | Date | RE: attribute-set and xsl:use-attri, Harbarth, Juliane |
Month |