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

Re: Read a parent node for particular chid using xsl

Subject: Re: Read a parent node for particular chid using xsl
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 24 Mar 2004 09:42:29 +0000
xsl parent axis
Hi Shashi,

> I am not able to display the result as parent tile and child title
> in single row.

I think that you're probably having problems because the template for
ReferencedBy does:

  <xsl:value-of select="//Result/@title" />

This will *always* give you the title of the first Result in your
document because it's an absolute path: it starts at the root node for
the document, finds all the title attributes of the Result elements,
and then gives you the value of the first one.

What you want is to get the title attribute of the Result element
that's the parent of the current ReferencedBy element. To do that, use
the parent axis:

  <xsl:value-of select="parent::Result/@title" />

A shorthand for getting the parent of a node is "..", so you could
alternatively use:

  <xsl:value-of select="../@title" />

Note that you probably want to make the same change to the rest of the
paths in that template.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

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.