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

Re: selecting with text nodes

Subject: Re: selecting with text nodes
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 2 May 2002 15:22:16 +0100
Re:  selecting with text nodes
Hi Ian,

> I want to select only the major recommendations that are not
> completed

First select all the recommendations:

  recommendation

Then filter that node set with a predicate. The predicate needs to be
true if the section element child of the recommendation has the value
'major':

  section = 'major'

and the completed element child of the recommendation has the value
'yes':

  completed = 'yes'

to give:

  recommendation[section = 'major' and completed = 'yes']

It looks as though you want to filter the content of the
recommendation a bit, to remove the completed child element, so you
could simply apply templates to the recommendation elements:

  <xsl:apply-templates
    select="recommendation[section = 'major' and
                           completed = 'yes']" />

and have a template that does what you want with them:

<xsl:template match="recommendation">
  <recommendation>
    <xsl:copy-of select="section | para" />
  </recommendation>
</xsl:template>

> All the examples I can find are based on attributes.

Selecting child elements is just like selecting attributes, except
that you use the child axis rather than the attribute axis (leave off
the '@'). The value of an element is its textual content.

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.