xsl-list
[Top] [All Lists]

RE: Axis order and variables

2003-05-23 06:40:10


De : gutman(_at_)novosoft-usa(_dot_)com 
[mailto:gutman(_at_)novosoft-usa(_dot_)com]
Consider the following XML
  <x n="1">
    <x n="2">
      <test/>
    </x>
  </x>
        <xsl:variable name="x" select="ancestor::x"/>
        <xsl:value-of select="$x[1]/@n"/>

What is the expected result? Is it "1" or "2"?

  >   The proximity position of a member of a node-set
  >   with respect to an axis is defined to be the position
  >   of the node in the node-set ordered in document order
  >   if the axis is a forward axis and ordered in reverse
  >   document order if the axis is a reverse axis. 

I think this is pretty clear. The ancestor:: axis is a reverse 
axis (the first ancestor of a node is its parent), therefore 
the expected answer is 2.

Cheers,
Dave.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list