xsl-list
[Top] [All Lists]

How can I always match the immediate ancestral element?

2004-05-12 01:16:21
Given:

<section id="foo"><!-- *1 -->
  <anchor id="a"><!-- *2 -->
  <section><!-- *3 -->
    <anchor id="b"><!-- *4 -->
  </section>
</section>

How can I define a template for the "anchor" so that I can test if the 
first "anchor" inside the immediate ancestral "section" is the current 
"anchor" node?

For example, when I'm processing *4, I want to test if the first anchor 
element inside its immediate ancestral section (*3) is itself (*4). 

I've tried:

    key('section-name', @id)//anchor[1]

This results in matching *2 instead of *4.

Thanks much in advance.

-Taro


<Prev in Thread] Current Thread [Next in Thread>