Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored comparison operator for ChargeIndicator #153

Merged
merged 1 commit into from
Feb 15, 2020

Conversation

trashcandrummer
Copy link
Contributor

Prerequisite

Problem

When trying to create a HTML output for the electronic invoice mentioned above using the following batch file
java -jar saxon9he.jar ZUGFeRD-invoice.xml ZUGFeRD_1p0_c1p0_s1p0.xslt > output.html PAUSE
the following error will be shown in the console

Warning at char 27 in xsl:value-of/@select on line 1985 column 166 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
SXWN9000: Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
Warning at xsl:for-each on line 2083 column 78 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
SXWN9009: An empty xsl:for-each instruction has no effect
Warning at char 6 in xsl:value-of/@select on line 1010 column 126 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
SXWN9000: Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
Warning at char 6 in xsl:value-of/@select on line 1927 column 119 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
SXWN9000: Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
Warning at char 27 in xsl:value-of/@select on line 1985 column 166 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
SXWN9000: Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
Warning at char 6 in xsl:value-of/@select on line 1010 column 126 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
SXWN9000: Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
Warning at char 6 in xsl:value-of/@select on line 1927 column 119 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
SXWN9000: Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
Warning at char 27 in xsl:value-of/@select on line 1985 column 166 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
SXWN9000: Comparison of xs:untypedAtomic? to xs:boolean will fail unless the first operand is empty
Type error evaluating (. eq true()) in xsl:value-of/@select on line 1010 column 126 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
XPTY0004: Cannot compare xs:untypedAtomic to xs:boolean
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#1008
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#1007
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#1003
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#952
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#951
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#756
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#755
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#78
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by unknown caller (class net.sf.saxon.expr.instruct.ForEach) at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#77
at template altova:Root on line 65 of ZUGFeRD_1p0_c1p0_s1p0.xslt:
invoked by xsl:call-template at file:/C:/Users/meberl/Desktop/InvoiceToHtml/ZUGFeRD/stylesheet/ZUGFeRD_1p0_c1p0_s1p0.xslt#63
In template rule with match="/" on line 62 of ZUGFeRD_1p0_c1p0_s1p0.xslt
Cannot compare xs:untypedAtomic to xs:boolean

Cause

Line 1010 in the stylesheet:
The value of udt:Indicator (in this case false) has no type (xs:untypedAtomic).
The value of fn:true() is considered as xs:boolean.
The comparison with the operator "eg" fails, because the types of the two values are different and with the operator "eg" only values of the same type may be compared.

Solution

Replacing the operator "eg" with the operator "=" ensures that the type is automatically determined for comparison (in this case the type of fn:true() which is boolean).
With my changes the HTML file can be created successfully.

@jstaerk jstaerk merged commit 06651c0 into ZUGFeRD:master Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants