Subject: Re: trying to create a node-set of attribute nodes
From: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx>
Date: Mon, 10 Mar 2003 12:26:32 -0500 (EST)
|
On Mon, 10 Mar 2003, Jeni Tennison wrote:
> Hi Robert,
>
> > eg., if i wanted all attribute nodes with name "key", that's
> > just
> >
> > //@key
> >
> > but what if i want attr nodes where key is specifically equal to
> > "F"? i'm assuming that requires a predicate, but i've tested several
> > variations and none work. how do i ask if the string-value is equal
> > to "F"?
>
> Get the string value of the context node (the attribute) with the
> string() function:
>
> //@key[string(.) = "F"]
>
> or just use . and let the processor do the conversion of the attribute
> node to a string implicitly:
>
> //@key[. = "F"]
ah, this seems to explain something else i was looking at. if i
have the path
//element[@attr = "value"]
this will obviously select all "element"s with attribute "attr" whose
value is "value". if i were to write that out the long way, i would
get
//element[string(@attr) = "value"]
is that right? that is, using an attribute in a string context
forces it to be converted into its "string-value" value. ok,
things are starting to make more sense.
rday
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|