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

Re: Choosing content depending on content of other ele

Subject: Re: Choosing content depending on content of other element
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 25 Jul 2002 09:55:35 +0100
Re:  Choosing content depending on content of other ele
Hi Jochen,

> No I have the nodes /root/output/data/product_id and order/product
>
> Depending on the product_id output, I wan't to choose the equivalent
> node
>
> /root/order/product/@id='xxx'/content/@group

You're almost there with:

  /root/order/product[@id='/root/output/data/product_id']

The only problem is that you're comparing the id attribute of the
product with *the string* '/root/output/data/product_id' rather than
*the value of* the product_id element that you're selecting. Just
remove the quotes, and it should work:

  /root/order/product[@id=/root/output/data/product_id]

although it would be more efficient to hold the value of
/root/output/data/product_id in a variable and then reference that.

By the way, if the only products to which you're apply templates are
those that have the correct id, then there's no point testing whether
they have the correct id when you try to match them with a template
*as well*. Also, from what I can see, the only product elements are
those within the order, so you may as well have the template just
match any product element; the only ones it will process are the ones
you apply templates to:

<xsl:template match="product">
  <br/><xsl:value-of select="content/@group"/>
</xsl:template>

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.