[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How do I access the nodeset that the IDREF refers

Subject: Re: How do I access the nodeset that the IDREF refers to?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 08 Jan 2003 18:12:26 -0500
max subnode xsl
Bix,

Assuming your XSLT processor is respecting the declarations in your DTD, I bet you'd find in your effort:

<xsl:variable name="linkRef">
  <xsl:value-of select="id(subnode/link[@idr])" />
</xsl:variable>

changing id(subnode/link/@idr) will work better for you (those link elements don't actually have content so the id() function is getting no argument ... from anyone ...)...

... but I bet

<xsl:variable name="linkRef" select="id(subnode/link/@idr)"/>

would work even better (it binds the retrieved nodes to the variable, not the string value of the first one).

I hope that helps,
Wendell

At 05:25 PM 1/8/2003, you wrote:
Hi all,

I'm not sure if I simply didn't use the right words, or I couldn't find the right combination of words, but I have not quite found the answer to my question in the FAQ or the archives.

Given a DTD similar to this:

<!ELEMENT root (subnode)*>
<!ELEMENT subnode (link)*>
<!ELEMENT link EMPTY>

<!ATTLIST subnode
    id     ID     #REQUIRED>

<!ATTLIST link
    idr    IDREF  #REQUIRED>

What I would like to know is how I can access the nodeset of the subnode element listed within the link element. An example xml file might be:

<root>
 <subnode id="a" />
 <subnode id="b">
   <link idr="c" />
   <link idr="d" />
 </subnode>
 <subnode id="c">
   <link idr="e">
 </subnode>
 <subnode id="d" />
 <subnode id="e" />
</root>


An application might be to sort the list of four subnodes (a,b,c,d) based on their links. An algorithm might be:
1. for every not(subnode/link), display subnode id
2. for every (subnode/link)
2a. choose
when link reference node contains link
repeat step 2 with link reference node
otherwise
if link reference has not been displayed
display link reference id
2b. display subnode id



My question is essentially: how would I create a variable that contains the nodeset of the link reference? First I would need it to test the link to determine if the link itself had links. Next I would want to pass that link back into step two so that I could query its links.


Would the following XSL be something close?

   <xsl:variable name="linkRef">
       <xsl:value-of select="id(subnode/link[@idr])" />
   </xsl:variable>


Thanks in advance! Bix

_________________________________________________________________
The new MSN 8 is here: Try it free* for 2 months http://join.msn.com/?page=dept/dialup



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


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.