|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






