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

Re: need position() of second document

Subject: Re: need position() of second document
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Fri, 28 Sep 2001 18:24:53 -0400
Re:  need position() of second document
[<ken.dickerson@xxxxxxxxxxx>]
>
> The $controls file has unique strings I am thinking about replacing the
above with something like this (I like this approach better so I don't have
to take the time to walk through every element of $control just to find a
single unique node):
>      <xsl:variable name="str"
select="document($controls)//*[name()=$tag]"/>
>      <xsl:variable name="pos" select="position()"/>
> and then using the pos for the attribute id (i.e. <TABLE id="{$pos}"...> )
> I could then use the pos as an index later (i.e.  "item[$pos]" ).
> Essentially, I need to get (from the $control file) the tagName, the node
value, and the position() of these items.
>
> My question is, how do I reference the $controls document when I need to
get the position? The code above returns the position in my first file, not
the second document file that I had just referenced. I'm sure this is a
simple answer, but I am not
> finding it in the books and references I have been looking at. Also, later
when I need to use the $pos as an index, I will also need to reference the
document file. Do I do it like this:  <...
select="document($controls)//item[$pos]"...>
>

I'd try using a key that returned the position() of the node in $controls.
Remember that you have to be in the context of document($controls) for the
key lookup to work right.  Then you feed the key your tagName, and it
returns the position.

Cheers,

Tom P


 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-2011 All Rights Reserved.