Re: [xsl] need position() of second document

Subject: Re: [xsl] need position() of second document
From: "Thomas B. Passin" <tpassin@xxxxxxxxxxxx>
Date: Fri, 28 Sep 2001 18:24:53 -0400
[<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