[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] match selection formulae


Subject: RE: [xsl] match selection formulae
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Fri, 7 Sep 2001 16:31:06 +0100

> So if i'm reading you correctly, the following:
>
> match="foo[@bar!='']"
>
> 1. <foo>x</foo>
> 2. <foo bar="">x</foo>
> 3. <foo bar="x">x</foo>
>
> should match #3 only?

yes
>
> and are these two expressions equivalent?
> match="foo[@bar!='']"
> match="foo[not(@bar='')]"

<foo/> matches the second but not the first.

Always read [node op value] as [exists $n in node such that $n op value]. So
the first is true if there is an @bar attribute and its value isn't ""; the
second is true if there isn't an @bar attribute whose value is "".

Mike Kay
>
>
>
>
> -----Original Message-----
> From: Michael Kay [mailto:mhkay@xxxxxxxxxxxx]
> Sent: Friday, September 07, 2001 5:28 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] match selection formulae
>
>
> > In my naiveity, I thought that @rend='' would be the
> > equivalent of testing for
> > the non-existence of an attribute - however, not(@rend)
> > doesn't appear to work either.
>
> boolean(@rend) is true if the attribute exists
> not(@rend) is true if the attribute doesn't exist
> @rend='' is true if the attribute exists and has the value "".
>
> Mike Kay
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>  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