In the canon product example, if I want to use index 'i' inside the xquery tag, how should it be done? Relevant code is pasted below:
<file action="write" path="catalog/a.xml" charset="UTF-8">
<loop item="item" index="i">
<list></list>
<body>
<xquery>
<xq-param name="item" type="node()"></xq-param>
<xq-expression><![CDATA)
let $desc := data($item//*)
let $price := data($item//*)
return
<product>
<count>$i</count> <-- Dump the count here, but this does not work.
</product>
]]></xq-expression>
</xquery>
</body>
</loop>
</file>
You need to pass it to XQuery as a parameter
<xq-param name="i" type="integer"> <var name="i"/> </xq-param>
Log in to post a comment.
In the canon product example, if I want to use index 'i' inside the xquery
tag, how should it be done? Relevant code is pasted below:
<file action="write" path="catalog/a.xml" charset="UTF-8">
<loop item="item" index="i">
<list></list>
<body>
<xquery>
<xq-param name="item" type="node()"></xq-param>
<xq-expression><![CDATA)
let $desc := data($item//*)
let $price := data($item//*)
return
<product>
<count>$i</count> <-- Dump the count here, but this does not work.
</product>
]]></xq-expression>
</xquery>
</body>
</loop>
</file>
You need to pass it to XQuery as a parameter