Subject: Re: [xsl] Testing strings for null From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Tue, 9 Jan 2001 09:34:20 +0000 |
Hi Paul, > <xsl:when test="ASTRING $igt$ 0"> That syntax isn't XSLT syntax - it looks like you're using the old MSXSL syntax. Have a look at http://www.netcrucible.com/xslt/msxml-faq.html to find out about it. The correct syntax for the test in XSLT is: ASTRING > 0 This tests whether any of the ASTRING elements in your XML source have a string value greater than 0. If you have an ASTRING element that looks like: <ASTRING>3</ASTRING> then it'll return true. If none of the ASTRING elements have numerical values, then it will return false. > I just want to know if ASTRING is null, and I can't seem to figure > out what to do. This test comes up False every time. By finding out whether ASTRING is null, do you mean whether there are any ASTRING elements or whether the value of the ASTRING element is an empty string? To test whether there are any ASTRING elements, use, simply: ASTRING This will return true if there are any ASTRING elements, false if there are not. To test whether there are any ASTRING elements that have a value that is not the empty string, you can use: ASTRING[string(.)] This will return true if there are any ASTRING elements that have a value, and false if there aren't. If you've only got one ASTRING element child in the current context and you want to test whether it has a value, you can use: string(ASTRING) This will return true if the ASTRING element has a value, false if it doesn't. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Testing strings for null, Paul Holman | Thread | [xsl] Avoiding the use of count whe, Anchal Jain |
Re: [xsl] xsl:key and document(), David Carlisle | Date | Re: [xsl] My Transformation can't b, Dimitre Novatchev |
Month |