SQL Joins in XPath
I would like to calculate the sum of the prices whos attribute (idnr) can be found under params. In this sample case I want the result to be 342 + 13 + 19 + 1200 = 1574.
My problem is matching the PRICE attributes with the ID names. In SQL this would have been solved with nested queries or a JOIN.
How can I solve this problem?
_______________________________
This is how I want the XSLT code to look like:
<xsl:value-of select="sum(/PRODUCTS/*[Here I'd like to match attribute::idnr with name(/PARAMS/*)]/text())"/>
The XML data:
...
<PARAMS>
<ID5>on</ID5>
<NAME>Anders</NAME>
<ID1>on</ID1>
<ID2>on</ID2>
<DEBUG>TRUE</DEBUG>
<ID8>on</ID8>
</PARAMS>
...
<PRODUCTS>
<PRICE idnr="ID1">13</PRICE>
<PRICE idnr="ID2">19</PRICE>
<PRICE idnr="ID3">23</PRICE>
<PRICE idnr="ID4">54</PRICE>
<PRICE idnr="ID5">342</PRICE>
<PRICE idnr="ID6">756</PRICE>
<PRICE idnr="ID7">1100</PRICE>
<PRICE idnr="ID8">1200</PRICE>
</PRODUCTS>
...
|