Subject: [xsl] Non Existent attribute, and other things. From: Richard Mitchell <Richard.Mitchell@xxxxxxxxxxxxx> Date: Mon, 12 Mar 2001 12:51:59 -0000 |
Well I would have thought that a possibly non-existent attribute is 0 or not would be not(number(@value)) But that seems to return false when the attribute isn't there. So I end up doing... count(@value) = 0 or not(number(@value)) ...which just seems a little awkward. Also thanks for all of the help with the ancestor-or-self business the other day. Because I was using the test so often I have actually ended up putting it in a scripting tag ( sorry ). As calling xsl:template xsl:with-param was just too much too often, also 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. Finally I thought there was an equivalent to the C ?: notation in XSL but I can't seem to find it. 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> <menu name="{$name}"> There must be a more succinct method. Thanks for all the help but it looks like I won't be able to persuade my company to send me to the XSLT conference so hope you all have a good time. Richard Mitchell Software Developer http://www.vbnonline.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Controlling ancestor refe, Jeni Tennison | Thread | Re: [xsl] Non Existent attribute, a, David Carlisle |
[xsl] Controlling ancestor referenc, Roshan Sharma | Date | RE: [xsl] splitting one xml into ma, Michael Kay |
Month |