This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: selecting with text nodes
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Ian Hord" <ian at hord dot com>
- Cc: xsl-list at lists dot mulberrytech dot com
- Date: Thu, 2 May 2002 15:22:16 +0100
- Subject: Re: [xsl] selecting with text nodes
- Organization: Jeni Tennison Consulting Ltd
- References: <LPBBLKDCEPEKCEAEBNFGKEMCCGAA.ian@hord.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
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