RE: [xsl] Detecting presence of attributes

Subject: RE: [xsl] Detecting presence of attributes
From: Rosa I-Ting Cheng <Rosa@xxxxxxxxxxxxx>
Date: Mon, 5 Feb 2001 10:02:05 +1100
what u have only checks whether @foo has an attribute or not, it doesn't
tell u whether @foo exists or not, so to test both u'll have to
<xsl:if test="@foo='' or @foo">
hope that helps

-----Original Message-----
From: Peter Flynn [mailto:peter@xxxxxxxxxxx]
Sent: Monday, 5 February 2001 9:22 AM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Detecting presence of attributes


I'm having a problem with detection of the presence of attributes.
If I say
<xsl:if test="@foo=''"> then I would expect the condition to be true if 
(a) the attribute foo was specified but the value was the null string 
"", or
(b) the attribute foo was not specified at all.

xt does not appear to honor either. Is this a bug in xt, or have 
I missed 
some additional piece of syntax. What I want is the equivalent to 
Omnimark's condition `when attribute foo is specified'.

A second problem arises with the position() function. In xt this appears
only to work within an <xsl:for-each> loop, not in a node group
instantiated by a match or select. Is this a bug or just my misreading?

///Peter








 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread