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

RE: XSL-Beginner-Problem

Subject: RE: XSL-Beginner-Problem
From: Cams Ismael <Ismael.Cams@xxxxxxxxxxxxxxx>
Date: Fri, 22 Nov 2002 11:14:51 +0100
terajoule
<xsl:template match="/">
   <xsl:for-each select="/energyreport/energyconsumption">
      <xsl:value-of select="@year"/>
  </xsl:for-each>
  Oil
  <xsl:apply-templates
select="energyreport/energyconsumption/terajoule[@energy='Oil']"/>
  Gaz
  <xsl:apply-templates
select="energyreport/energyconsumption/terajoule[@energy='Gaz']"/>
</xsl:template>

<xsl:template
match="energyreport/energyconsumption/terajoule[@energy='Oil']">
	<xsl:value-of select="text()"/>
</xsl:template>

<xsl:template
match="energyreport/energyconsumption/terajoule[@energy='Gaz']">
	<xsl:value-of select="text()"/>
</xsl:template>

-----Original Message-----
From: Sorin Marti [mailto:mas@xxxxxxxxxx]
Sent: vrijdag 22 november 2002 11:02
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  XSL-Beginner-Problem


Hi all,

I am new to XSL and I am experimenting around... I've got an XML-File 
with the following structure

<energyreport>

 <energyconsumption year="1970">
    <terajoule energy="Oil">2222</terajoule>
    <terajoule energy="Gaz">3333</terajoule>
    <terajoule energy="Coal">4444</terajoule>
 </energyconsumption>

 <energyconsumption year="1980">
    <terajoule energy="Oil">9222</terajoule>
    <terajoule energy="Gaz">9333</terajoule>
    <terajoule energy="Coal">9444</terajoule>
 </energyconsumption>

[and so on...]

</energyreport>

I want to get out following structure, as simple text output (it is for 
a LaTeX-File):


1970
1980
Oil
2222
9222
Gaz
3333
9333
Coal
4444
9444


How to make that work? I tried this:

<xsl:template match="/">
   <xsl:for-each select="/energyreport/energyconsumption">
      <xsl:value-of select="@year"/>
  </xsl:for-each>
</xsl:template>

That gives out the years, that's fine... but how to select the 
energy-attribute (only once each)?

Every advice apreciated

Thanks in advance

Sorin Marti


 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

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.