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

How to optionally create an attribute?

Subject: How to optionally create an attribute?
From: Donald Ball <balld@xxxxxxxxxxxxxxx>
Date: Sun, 14 Nov 1999 23:34:42 -0500 (EST)
xsl test condition
Hiya. I've got some elements that I'd like to optionally have attributes.
I tried the obvious:

<element>
 <xsl:if test="$condition">
  <xsl:attribute name="name">value</xsl:attribute>
 </xsl:if>
 ...
</element>

but (the latest) XT did not like this. The other naive approach:

<xsl:choose>
 <xsl:when test="$condition">
  <element name="value">
   ...
  </element>
 </xsl:when>
 <xsl:otherwise>
  <element>
   ...
  </element>
 </xsl:otherwise>
</xsl:choose>

works but requires replicating the ... elements twice, which is cumbersome
and (hopefully) unnecessary. Can anyone suggest an alternate approach?
Please reply directly (and to the list if this is of general interest) as
I'm subscribing in digest mode. Thanks.

- donald


 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.