[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Referencing value of non-sibling node

Subject: Re: Referencing value of non-sibling node
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Sat, 6 Apr 2002 18:23:23 +0100
mt element
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/


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.