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

Determining if an optional attribute is present

Subject: Determining if an optional attribute is present
From: "Sam Carleton" <scarleton@xxxxxxxxxxxxxxxx>
Date: Tue, 17 Oct 2006 12:36:35 -0400
 Determining if an optional attribute is present
Determining if an optional attribute is present

Here is the source XML:

<node id="1" version="1">
</node>
<node id="4" version="3" revision="2">
</node>

Here is the output I need:

<node id="1" version="1" revision="0">
</node>
<node id="4" version="3" revision="2">
</node>

Logically it would seem that this would do it:

<xsl:attribute name="revision">
 <xsl:if test="not(string(@revision)) = false()">
   <xsl:value-of select="@revision"/>
 </xsl:if>
 <xsl:if test="not(string(@revision))">
   <xsl:text>0</xsl:text>
 </xsl:if>
</xsl:attribute>

But in both cases, whether or not the revision is present,
not(string(@revision)) always returns false.  I have tried this with
both the debugger in XMLSpy and with MSXML 4.0.  The target parser is
MS .Net 2.0.

Sam
--
Miltonstreet Photography
http://www.miltonstreet.com

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.