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:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old July 28th, 2003, 06:55 PM
PommieChick PommieChick is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 21 PommieChick User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 55 sec
Reputation Power: 0
clueless on XSL:Variables!

Hi All

I have a question about using xsl:variables and how I could use them for loop counters or holding a temporary list of data that i want to do more processing on

I have an XML file with graph data that i need to extract the data sets from and concatenate into a comma separated string
e.g

<Graph>
<Params>
<ParamName>dataset0yValues</ParamName>
<ParamValue>123456</ParamValue>
</Params>
<Params>
<ParamName>dataset1yValues</ParamName>
<ParamValue>9384</ParamValue>
</Params>
.
.
.
<Params>
<ParamName>dataset0Name</ParamName>
<ParamValue>Sales YTD</ParamValue>
</Params>
<Params>
<ParamName>dataset1Name</ParamName>
<ParamValue>Sales Jun 03</ParamValue>
</Params>
.
.
.
</Graph>


i am using the following XSL transformation to parse this data to come up with a comma separated string
e.g

<xsl:for-each select="Graph/Params">
<xsl:if test="contains(ParamName, 'Values')">
<PARAMS BARDATA=><xsl:value-of select="concat(ParamValue, ',')"/>>
</xsl:if>
</xsl:for-each>

which gives me:

<PARAMS BARDATA=123456,9384,>

the problem is that this leaves an extra ',' before the end '>' > 'greater than' sign.

can i use xsl:variables to store a temporary string then do a substring on it when the xsl:for-each loop has finished?


in any given xml file with graph data, i don't know how many <Params> sections there will be

any tips gladly received

tia




Reply With Quote
  #2  
Old July 29th, 2003, 05:24 AM
Wizard2003's Avatar
Wizard2003 Wizard2003 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 206 Wizard2003 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 29 m 24 sec
Reputation Power: 6
Hi Tia,

there is no possibility to set a variable more than once.
Try to solve your problem recursivly or remove the comma at the end of the string with something like:
Code:
substring(PARAMS/@BARDATA,1,string-length(PARAMS/@BARDATA)-1)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > clueless on XSL:Variables!


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