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

xsl:choose to define conditional attributes?

Subject: xsl:choose to define conditional attributes?
From: oberthier@xxxxxxxxxxxx
Date: Thu, 30 Sep 1999 21:02:16 +0100 (CET)
xsl choose attribute
I'm currently trying to define some conditional processing in
order to be able to derive different values for some attributes 
thanks to <xsl:choose> and <xsl:when>.

For instance, using the transformation to generate some HTML, 
and a <LABEL> tag in the example below, I'd like to do
something like the following:

<label>
  <xsl:attribute name="id">myLabelId</xsl:attribute>
  <xsl:choose>
    <xsl:when test=". = ''">
      <xsl:attribute name="style">MyStyleEmpty</xsl:attribute>
    </xsl:when>
    <xsl:otherwise>
      <xsl:attribute name="style">MyStyleFull</xsl:attribute>
    </xsl:otherwise>
  </xsl:choose>
  The Label
</label>

generating:
<label id="myLabelId" style="MyStyleEmpty">The Label</label>
when the content of the element selected is null, and:
<label id="myLabelId" style="MyStyleFull">The Label</label>
when it's populated with some data.

However the above XSL doesn't seem to work. I suspect it is
because the XSLT WD states that it should be used for templates
only. Ok, but then, how to implement this type of conditional 
processing (and thus to avoid duplicating the whole definition 
of the LABEL tag)?

Thanks for your help,

Olivier.


 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.