Subject: Re: idref() From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Tue, 04 May 1999 14:32:02 -0400 |
At 99/05/04 16:26 +0200, Bovone Stefano wrote: >May I have an example of how I can use idref() ? Below is another page excerpted from the handouts of my XSLT tutorial next Tuesday at WWW8 in Toronto. I hope this helps. ......... Ken Module 10: Advanced Expressions and Transformation Lesson 2: Cross Referencing Techniques Element Referencing Recall that element nodes in the source node tree can have unique identifiers defined by the presence of XML attributes of type ID. It is a common practice to implement cross referencing from other elements using XML attributes of type IDREF that point to the unique identifiers of elements with the corresponding ID attribute. A stylesheet can obtain an element node by its unique identifier through the following functions: · the id() function converts its argument to a string and either returns a node set with a single member being that element node with the unique identifier being equal to the string, or returns an empty node set if the string argument is empty or there is no element with a unique identifier being equal to the argument · the idref() function converts each node of its node-set argument into a string of whitespace separated tokens and with the resulting union of tokens builds a return node set being the set of all element nodes whose unique identifier is in the set of tokens These functions can be used stand-alone or as a step in a multiple-step location path of an expression: · id("buyer") returns the element whose unique identifier is the string value "buyer" · id(1) returns the element whose unique identifier is the string value "1" · idref(@where) returns the element whose unique identifier is the same value as the value of the where= attribute of the current node · idref(@where)/phone[2] returns the second phone child element of the element whose unique identifier is the same value as the value of the where= attribute of the current node · idref(//@where)/phone[2] returns the set of the second phone child elements of all elements referenced by any use of the where= attribute of any element node in the instance +//ISBN 1-894049::CSL::Courses::PFUX//DOCUMENT An Introduction to XSLT 1999-05-04 14:00//EN The Eighth International World Wide Web Conference May 11, 1999 Page 183 http://www.CraneSoftwrights.com Copyright © Crane Softwrights Ltd. -- 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. Next instructor-led XSLT Training: WWW8:1999-05-11 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
idref(), Bovone Stefano | Thread | Re: idref(), G. Ken Holman |
idref(), Bovone Stefano | Date | front end template questions, Tom De Carlo |
Month |