[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Question about "for-each select"

Subject: [xsl] Question about "for-each select"
From: "Bert" <arm@xxxxxxxxx>
Date: Thu, 22 Jan 2004 20:21:56 +0100


I need some help/advice on the following subject.

>From the xml-file below I want to get the information of all the males who
are 41.

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="persons.xsl"?>

I use the following template to do that (at least I try to do that):

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
 <xsl:output method="xml" indent="no"/>
 <xsl:template match="/">
   <xsl:for-each select="root/person[gender = 'male']">
    <xsl:sort select="name" order="ascending"/>
    <xsl:value-of select="name"/>
    <xsl:value-of select="' - '"/>
    <xsl:value-of select="age"/>

Actually I need a 'for-each'-statement like this:
<xsl:for-each select="root/person[gender = 'male']" AND "root/person[age =

This obviously doesn't work. Can it be done this way and if not, how can I
achieve my goal?
As you can see help is welcome!

Kind regards,

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

Current Thread