Closed Cicorione closed 3 weeks ago
The error message sucks... But the code is incorrect:
<SetVariable variable="MONTH" select="January"/>
<SetVariable variable="YEAR" select="2020"/>
selects the XML nodes 'January' and '2020' (I believe that this is even an invalid name) of a non-existent XML node.
You probably mean
<SetVariable variable="MONTH" select="'January'"/>
<SetVariable variable="YEAR" select="'2020'"/>
(the apostrophes in the select attribute)
which selects the strings January
and 2020
(untested)
My badβ¦ π
But I tested the global variables and are working the way I expected. π
I am pretty sure I already asked about that and you already explained this to me. π€¦ββοΈ
As a matter of fact after your reply I rechecked the documentation and I found this example:
<SetVariable variable="greeting" select="'Hello User'"/>
I totally missed the apostrophes, now I made some assumptions, because numbers and values don't need to be within apostrophes:
select="1234"
β this is a mathematical variable select="$A"
β this is a mathematical variable tooWhile:
select="'myText'"
β this is a text stringselect="'$A'"
β this is a text string tooAre my assumptions correct? π€·ββοΈ
Thanks! π
select="1234"
β this is a mathematical variable
correct, although not a variable but a constant.
select="$A"
β this is a mathematical variable too
no, this is an XPath expression that copies the content of the variable A (but a perfectly valid expression). A might contain a number or a string, but also a document or an XML fragment or any other sequence of items.
While:
select="'myText'"
β this is a text stringselect="'$A'"
β this is a text string too
both correct.
I'll close this issue and fix the error message in #621
This will fix the error message only, not the cause of the issue (which I believe, is not really fixable unless I introduce a new command)
Hi @pgundlach
I am not sure if this behavior is correct but global variables, I mean outside any
record
, when are strings let Publisher fail the PDF generation:Layout:
Data:
Thanks π