Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Parallel data traversal [Thread Next] Re: Parallel data traversalTo: NULL Date: 9/10/2007 12:06:00 PM Vojta <dr.fie@s...> wrote in <1189410536.254273.316180@r...>: > <root> > <items1> > <i1>..</i1> > <i1>..</i1> > </items1> > <items2> > <i2>..</i2> > <i2>..</i2> > </items2> > </root> > > If my context node is the k-th node in items1 is to > possible to create XPath that finds a k-th node in items2? > Something like "../../ items2[position() = position(.)]" - > which does not work because "." is bound to some "i2" node > inside the square brackets. > > Obviously the most natural solution is to do some data > preprocessing to "zip" items1 and items2 together or > modify our repeater to be able to have multiple context > nodes. That is the most natural solution indeed. And it's a trivial transformation, too. > But isn't there any pure xpath way to do this? Short answer: no, there isn't any pure XPath way of doing that. You need either variables (that is, you have to generate the XPath expression on the fly, it cannot be static), or XPath extensions (XSLT defines the current() function which returns the current node; but the notion of the current node is defined by XSLT spec as well, and isn't by itself meaningful outside of XSLT context). -- This chickenus crossed the roadus while yodelingus. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
