This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Selecting all the children accept those with particular attribute values
- To: xsl-list at lists dot mulberrytech dot com
- Subject: RE: [xsl] Selecting all the children accept those with particular attribute values
- From: "Clapham, Paul" <pclapham at core-mark dot com>
- Date: Thu, 1 Feb 2001 22:40:30 -0800
- Reply-To: xsl-list at lists dot mulberrytech dot com
If you want all "except those with @att equal to value1 or value2", you need
to code something equivalent to "@att != 'value1' and @att != 'value2'".
Note the AND here, not an OR. Think about it for a minute... suppose @att
is value1. Then it's not equal to value2 and your OR returns true. But if
it's value2, then it's not equal to value1 and your OR returns true. And if
it's something else, then it's not equal to either and your OR returns true.
This is an old pitfall that has snared generations of computer programmers.
PC2
-----Original Message-----
From: Jo Bourne [mailto:venus@va.com.au]
Sent: February 1, 2001 19:41
To: xsl list
Cc: Jesse Reynolds
Subject: [xsl] Selecting all the children accept those with particular
attribute values
Hi,
In one of the templates in my stylesheet I need to match all the children of
the current node except those with @att equal to value1 or value2. I have
tried this so many different ways and I just can't seem to get it right....
Can I even do this in a single select or do I need to call a pre-prepared
set?
My current failed attempt looks like this:
<xsl:template match="parent">
[......]
<xsl:for-each select="child::*/[@att != 'value1' | @fy !=
'value2']">
[......]
</xsl:template>
I started off more like this:
<xsl:template match="parent">
[......]
<xsl:for-each select="child::*[@att!=('value1'|'value2')]">
[......]
</xsl:template>
Thanks heaps
Jo
--
Jo Bourne
Virtual Artists Pty Ltd
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list