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

RE: Attribute to elements conversion, preserving and

Subject: RE: Attribute to elements conversion, preserving and simplifying hierarchy, insertion of new element
From: "jcastanheira@xxxxxxxxxxxxxxxxxxxx" <jcastanheira@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Nov 2004 10:06:52 -0500
xsl stylesheet attributes
Finally, I've found the solution. Here it is :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<eurofxref>
			<xsl:apply-templates/>
		</eurofxref>
	</xsl:template>
	<xsl:template match="*[@*]">
		<Row>
			<time>
				<xsl:value-of select="./@time"/>
			</time>
			<xsl:apply-templates select="*/@currency"/>
	</Row>

	</xsl:template>


	<xsl:template match="@currency">
		<xsl:variable name="Thename" select="."/>
		<xsl:variable name="Therate" select="../@rate"/>
		<xsl:element name="{$Thename}">
			<xsl:value-of select="$Therate"/>
		</xsl:element>
	</xsl:template>
</xsl:stylesheet>

Result :

- <x>
- <row>
      <time>2004-11-19</time>
         <USD>1.302</USD>
         <JPY>134.97</JPY>
  </row>
- <row>
     <time>2004-11-18</time>
..

Subject: RE:  Attribute to elements conversion, "preserving "and
simplifying hierarchy, insertion of new element
From: "Joe Heidenreich" <HeidenreichJ@xxxxxxxx>
Date: Fri, 19 Nov 2004 11:38:04 -0500

Do you want the <Row> to appear for each date?

Jeni has a great example on how to add hierarchy to a flat structure. You
can
view that here:
http://www.biglist.com/lists/xsl-list/archives/200012/msg00175.html



--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .

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.