[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Referencing value of non-sibling node

Subject: Re: [xsl] Referencing value of non-sibling node
From: Kim <kimba_40@xxxxxxxxx>
Date: Tue, 9 Apr 2002 14:03:26 -0700 (PDT)

Hi Jeni,

Thank you very much for your sugesstion.  Yes, each <r> index is supposed to
map w/ each <mt> fr. the xml input file.  I was able to make it work w/ a
similar technique (position()) but w/ diff. details.

--- Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> wrote:
> Hi Kim,
> > My specific question is when I have matched a <moid> and also
> > matched a <mt> value, how do I specify/reference the corresponding
> > indexed <r> value? In the example above, if I match <mt>mtVal4, the
> > fourth element, I would also print out the fourth <r>rVal4 value.
> From what I can tell, each <mt> is associated with a particular <r>
> based on its position, so the first <mt> in a <mi> is related to the
> first <r> within the <mv> of that <mi>, the second <mt> with the
> second <r> within the <mv> of the <mi> and so on. Is that accurate?
> If so, then in your template matching the <mt> element, you have to
> first find out the index of the <mt> within the <mi>. Now, you're
> actually applying templates to these <mt> elements in order, so this
> is quite easy -- all you have to do is store the position() of the
> current <mt> element in a variable:
>   <xsl:variable name="index" select="position()" />
> and then use that index to find the <r> element within the <mt>
> element's parent <mi> element's child <mv> element with the same
> position:
>   <xsl:value-of select="parent::mi/mv/r[$index]" />
> If that isn't what you were after, give us a more detailed description
> of what the "corresponding <r>" means.
> Cheers,
> Jeni
> ---
> Jeni Tennison
> http://www.jenitennison.com/


May the force be with you.

Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax

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

Current Thread