With XProc I try to get value returned by a XPath on a loaded document and store it in a variable to apply next.
input.xml
<root>
<element id="test"/>
</root>
test.xpl
<p:load name="load-source-document" href="input.xml"/>
<p:variable select="/root/element/@id"/>
I tried this with Calabash but I get following error:
Cannot invoke "String.startsWith(String)" because "lexicalQName" is null
With XProc I try to get value returned by a XPath on a loaded document and store it in a variable to apply next.
input.xml
<root>
<element id="test"/>
</root>
test.xpl
<p:load name="load-source-document" href="input.xml"/>
<p:variable select="/root/element/@id"/>
I tried this with Calabash but I get following error:
Share Improve this question edited Nov 18, 2024 at 22:00 isherwood 61.2k16 gold badges122 silver badges170 bronze badges asked Nov 18, 2024 at 21:59 NicolasNicolas 12 bronze badges 1Cannot invoke "String.startsWith(String)" because "lexicalQName" is null
- Please don't tag your title question. See How to Ask. – isherwood Commented Nov 18, 2024 at 22:01
1 Answer
Reset to default 0Yes, it is possible to store the xpath value into the variable. Try updating your code to:
test.xpl
<p:declare-step xmlns:p="http://www.w3./ns/xproc">
<p:variable name="id-value" select="doc('input.xml')/root/element/@id"/>
<p:log message="Value is: {$id-value}"/>
</p:declare-step>
Getting the ID value can store into the variable like so.