XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 1st, 2003, 10:42 PM
mercury751 mercury751 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 3 mercury751 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question xslt help!!

I have the following data

<item><name>abc<name><color>red</color><price>15</price></item>
<item><name>abc<name><color>blue</color><price>15</price></item>
<item><name>abc<name><color>green</color><price>15</price></item>


<item><name>fff<name><color>red</color><price>15</price></item>
<item><name>fff<name><color>blue</color><price>15</price></item>
<item><name>fff<name><color>green</color><price>15</price></item>


Now i want to get output like this:
<item-name>abc</item-name>
<color>red<red>
<price>15</price>

<color>blue<red>
<price>15</price>

<color>green<red>
<price>15</price>


<item-name>fff</item-name>
<color>red<red>
<price>15</price>

<color>blue<red>
<price>15</price>

<color>green<red>
<price>15</price>


Any help would be greatly appreciated....THANKS!!!

Reply With Quote
  #2  
Old April 7th, 2003, 04:48 AM
Wingman Wingman is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Bavaria, Germany
Posts: 140 Wingman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 40 m 41 sec
Reputation Power: 6
.. xsl header ...

Code:

<xsl:template match="/item">

  <xsl:element name="item-name">
  	<xsl:value-of select="name/text()" />
  </xsl:element>
  
  <xsl:element name="color">
  	<xsl:value-of select="color/text()" />
  </xsl:element>
  
  <xsl:element name="price">
  	<xsl:value-of select="price/text()" />
  </xsl:element>
  
</xsl:template>


... xsl footer ...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xslt help!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway