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 March 25th, 2003, 09:03 PM
gnasher23 gnasher23 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 1 gnasher23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy recursive template problem

I have the xml and xsl below and the result when transformed that I'm trying to get is the following order of species. Is this even possible through xslt? I don't know if I'm approaching this the right way with a recursive template, I cannot find a way to pass the value of from of call of the template to the next. Any help or tips would be appreciated.

Order of: human
Order of: human, ape
Order of: human, ape, monkey


<?xml version="1.0" encoding = "ISO-8859-1"?>
<?xml-stylesheet type = "text/xsl" href="transform.xsl"?>
<species>
<animal name = "lizzard" order = "reptile" id = "1"></animal>
<animal name = "monkey" order = "primate" id = "2"></animal>
<animal name = "ape" order = "primate" id = "3"></animal>
<animal name = "human" order = "primate" id = "4"></animal>
<animal name = "crockadile" order = "reptile" id = "5"></animal>
</species>



<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:variable name = "limit" select = "count(species/animal[@order='primate'])" />
<xsl:variable name = "order-of" select = "'Order of: '" />

<xsl:template match = "species/animal" name = "printorder">
<xslaram name = "header" select = "$order-of" />
<xslaram name = "count" select = "0" />
<xsl:if test = "@order = 'primate'">
<xsl:for-each select = "@name">

<xsl:variable name = "nextname" select = "." />
<xsl:variable name = "newtext" select = "concat($header,$nextname)" />
<xsl:value-of select = "$newtext" /> <br />
<xsl:if test = "$count <= $limit">

<xsl:call-template name = "printorder" >
<xsl:with-param name = "header" select = "$newtext" />
<xsl:with-param name = "count" select = "$count + 1" />
</xsl:call-template>
</xsl:if>


</xsl:for-each>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > recursive template problem


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 3 hosted by Hostway