Hi,
Yes, I've just read a ton of posts saying we can't set global
variables. Maybe its the procedural programming mindset, but I can't
seem to find a way to solve this problem without being able to
conditionally "set" a variable.
Basically I am converting an xml to a csv. Given the following sample xml :
Code:
<envelope>
<request req_id="1">
------------
<payload data="data1"/>
------------
</request>
<response req_id="1">
<result id="result1"/>
<result id="result2"/>
<result id="result3"/>
</response>
<request req_id="2">
------------
<payload data="data2"/>
------------
</request>
<response req_id="2">
<result id="result4"/>
<result id="result5"/>
<result id="result6"/>
</response>
.
.
.
.
.
</envelope>
I first want to make sure that the req_id in the response is the same
as that in the immediately preceding request, before processing the
response.
The final output should look like :
Code:
data1, result1, result2, result3
data2, result4, result5, result6
.
.
.
.
.
dataN, result_, result__, result___
My approach would have been to set a 'reqId' variable each time within
a <xsl:template match="request"> and to set a 'dataVal' variable each
time within a <xsl:template match="payload"> and then use them
immediately as $reqId and $dataVal when i hit the response.
Any thoughts on how I can achieve this would be greatly appreciated.
Thanks very much,
rqaran