[XSL-LIST Mailing List Archive Home]
[Reply To This Message]
Re: Conditional xsl:use-attribute-sets
At 2009-06-01 15:44 -0400, G. Ken Holman wrote:
At 2009-06-01 12:37 -0700, Karl Stubsjoen wrote:
Am I doing something wrong because this is not working:
<xsl:if test="position() mod 2 = 0">
Is that the correct way to call an attribute set conditionally?
Unfortunately, attribute sets cannot be added conditionally. I've
wanted to do this myself in the past.
If you change the attribute set to a called template (no other
changes), then you can put the call to the template in the if.
Doing so takes away the cumulative nature of attribute sets in an
import/include tree, but if that isn't a concern for you, then a
called template should do the trick.
Another drawback of my suggestion is you do not get the feature of
attribute sets where a literal result element's specified attributes
take precedence over the like-named attribute in the referenced
set. To mimic that you'd have to follow the calling template with
attribute instructions that would have been satisfied with specified
So attribute sets still have their role, but they can only be
referenced in literal result elements or other attribute sets.
. . . . . . . . . Ken
XSLT/XSL-FO/XQuery hands-on training - Los Angeles, USA 2009-06-08
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format