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

RE: [xsl] Question about "for-each select"


Subject: RE: [xsl] Question about "for-each select"
From: "Kenny Akridge" <kakridge@xxxxxxxxxxxxx>
Date: Thu, 22 Jan 2004 15:15:08 -0500

Yes.

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Bert
Sent: Thursday, January 22, 2004 2:45 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Question about "for-each select"

Hi,

One more question about the same subject.
How about OR?
Can that be done too?

Bert


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Bert
Sent: donderdag 22 januari 2004 20:41
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Question about "for-each select"


Hi Josh,

Could it be so simple ...
Thanks a lot.

Kind regards,
Bert


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Josh Canfield
Sent: donderdag 22 januari 2004 20:35
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Question about "for-each select"


try

<xsl:for-each select="root/person[gender = 'male'][age=41]">

Josh
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Bert
Sent: Thursday, January 22, 2004 11:22 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Question about "for-each select"


Hi,

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"?>
<root>
 <person>
  <name>Bert</name>
  <gender>male</gender>
  <age>41</age>
 </person>
 <person>
  <name>Elisa</name>
  <gender>female</gender>
  <age>41</age>
 </person>
 <person>
  <name>Carl</name>
  <gender>male</gender>
  <age>40</age>
 </person>
</root>

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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="xml" indent="no"/>
 <xsl:template match="/">
  <document>
   <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"/>
    <br/>
   </xsl:for-each>
  </document>
 </xsl:template>
</xsl:stylesheet>

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

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,
Bert


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


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



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



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


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



Current Thread