|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 ![]() |
|
#2
|
||||
|
||||
|
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) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > clueless on XSL:Variables! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|