[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
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
|