[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xsl:attribute-set and xsl:use-attribute-sets

Subject: xsl:attribute-set and xsl:use-attribute-sets
From: "Larry Mason" <Larry_Mason@xxxxxx>
Date: Fri, 20 Aug 1999 08:11:57 -0500
use attribute sets

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.