Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Parallel data traversal

From: Pavel Lepin <p.lepin@-------.--->
To: 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.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent