This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Non Existent attribute, and other things.
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Non Existent attribute, and other things.
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Mon, 12 Mar 2001 13:36:06 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
> So I end up doing...
>
> count(@value) = 0 or not(number(@value))
To test if the value is present and non-zero, do boolean(@value!=0)
> could somebody explain what Jeni's suggestion meant when it
> said...
>
> key('Ps', $name)[count(.|$Ps) = count($Ps)]
>
> ...as I really don't understand it.
The predicate [count(.|$Ps) = count($Ps)] is true for any node that is a
member of the node-set $Ps, and false for any one that isn't. Yes, this
syntax really IS awkward!
>
> Finally I thought there was an equivalent to the C ?: notation
> in XSL but I can't seem to find it.
No, there isn't! It's on the requirements list for 2.0
On several occasions in my
> code I end with the same fragment.
>
> <xsl:variable name="shorter">
> <xsl:choose>
> <xsl:when test="@short">
> <xsl:value-of select="@short"/>
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="@name"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:variable>
>
If you prefer brevity to readability you can write
concat(@short, substring(@name, 1, not(@short)*100000))
I'll leave you to study the specs to work out why that works!
Mike Kay
Software AG
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list