Re: id/idref

Subject: Re: id/idref
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 15 May 1999 14:18:53 -0400
At 99/05/12 09:48 +0200, Bovone Stefano wrote:
>Is it wrong if I write:
>
><xsl:apply-templates select="id(@value)"/>
>
>I should write idref(@value).
>
>Is this correct?

Interestingly, this question came up from the students Monday during the
XSLT training course when examining one of the examples.

In your particular example, both are acceptable, because id() will convert
the argument (whatever type the argument is) to a string value before
looking for the element with the unique identifier.  The string value of a
node list is the generated value of the first item in the node list, which
is the value of the attribute, which works as you would expect.

For idref(), the argument is always a node set and the union of values of
all members is converted to set of unique identifiers and the value
returned is the set of corresponding element nodes.

For a simple attribute argument as you have, they work pretty much
identically.

Where the difference would be is if the attribute value has whitespace ...
the idref() would separate the value into separate identifiers for finding
elements, where the id() wouldn't.

I hope this helps.

.......... Ken

--
G. Ken Holman                  mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.           http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999  (Fax:-0995)
Website: XSL/XML/DSSSL/SGML services outline,  XSL/DSSSL shareware,
         stylesheet resource library, conference training schedule,
         commercial stylesheet training materials, on-line XSL CBT.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread