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

Problem generating HTML with multiple dates #88

Closed
doc-yh opened this issue Feb 7, 2024 · 4 comments · Fixed by OP-TED/efx-toolkit-java#100
Closed

Problem generating HTML with multiple dates #88

doc-yh opened this issue Feb 7, 2024 · 4 comments · Fixed by OP-TED/efx-toolkit-java#100
Assignees

Comments

@doc-yh
Copy link

doc-yh commented Feb 7, 2024

Hello,

I'm encountering an issue when generating the HTML associated with this ContractAwardNotice using the following command:

java -jar .\target\eforms-notice-viewer-0.10.0-app.jar -f fr .\can.xml
<?xml version="1.0" encoding="UTF-8"?>
<ContractAwardNotice xmlns="urn:oasis:names:specification:ubl:schema:xsd:ContractAwardNotice-2"
                     xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
                     xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
                     xmlns:efac="http://data.europa.eu/p27/eforms-ubl-extension-aggregate-components/1"
                     xmlns:efbc="http://data.europa.eu/p27/eforms-ubl-extension-basic-components/1"
                     xmlns:efext="http://data.europa.eu/p27/eforms-ubl-extensions/1"
                     xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ext:UBLExtensions>
        <ext:UBLExtension>
            <ext:ExtensionContent>
                <efext:EformsExtension>
                    <efac:NoticeResult>
                        <efac:LotResult>
                            <cbc:ID schemeName="result">RES-0001</cbc:ID>
                            <cbc:TenderResultCode listName="winner-selection-status">selec-w</cbc:TenderResultCode>
                            <efac:LotTender>
                                <cbc:ID>TEN-0001</cbc:ID>
                            </efac:LotTender>
                            <efac:SettledContract>
                                <cbc:ID>CON-0001</cbc:ID>
                            </efac:SettledContract>
                        </efac:LotResult>
                        <efac:LotTender>
                            <cbc:ID schemeName="tender">TEN-0001</cbc:ID>
                            <efac:TenderingParty>
                                <cbc:ID>TPA-0001</cbc:ID>
                            </efac:TenderingParty>
                            <efac:TenderReference>
                                <cbc:ID>5</cbc:ID>
                            </efac:TenderReference>
                        </efac:LotTender>
                        <efac:SettledContract>
                            <cbc:ID schemeName="contract">CON-0001</cbc:ID>
                            <cbc:AwardDate>2024-01-12+02:00</cbc:AwardDate>
                            <cbc:IssueDate>2024-01-29+02:00</cbc:IssueDate>
                            <efac:LotTender>
                                <cbc:ID>TEN-0001</cbc:ID>
                            </efac:LotTender>
                        </efac:SettledContract>
                        <efac:SettledContract>
                            <cbc:ID schemeName="contract">CON-0002</cbc:ID>
                            <cbc:AwardDate>2024-01-12+02:00</cbc:AwardDate>
                            <cbc:IssueDate>2024-01-29+02:00</cbc:IssueDate>
                            <efac:LotTender>
                                <cbc:ID>TEN-0001</cbc:ID>
                            </efac:LotTender>
                        </efac:SettledContract>
                        <efac:TenderingParty>
                            <cbc:ID schemeName="tendering-party">TPA-0001</cbc:ID>
                            <efac:Tenderer>
                                <cbc:ID>ORG</cbc:ID>
                            </efac:Tenderer>
                        </efac:TenderingParty>
                    </efac:NoticeResult>
                    <efac:NoticeSubType>
                        <cbc:SubTypeCode listName="notice-subtype">29</cbc:SubTypeCode>
                    </efac:NoticeSubType>
                    <efac:Organizations>
                        <efac:Organization>
                            <efac:Company>
                                <cac:PartyIdentification>
                                    <cbc:ID schemeName="organization">ORG</cbc:ID>
                                </cac:PartyIdentification>
                                <cac:PartyName>
                                    <cbc:Name languageID="FRA">XXX</cbc:Name>
                                </cac:PartyName>
                            </efac:Company>
                        </efac:Organization>
                    </efac:Organizations>
                </efext:EformsExtension>
            </ext:ExtensionContent>
        </ext:UBLExtension>
    </ext:UBLExtensions>
    <cbc:CustomizationID>eforms-sdk-1.9</cbc:CustomizationID>
    <cbc:NoticeLanguageCode listName="language">FRA</cbc:NoticeLanguageCode>
</ContractAwardNotice>

I've tried to simplify the XML as much as possible to reproduce the bug. It seems the bug occurs when we have multiple dates at the same time:

<xsl:value-of separator=", " select="format-date(for $tender2 in ./normalize-space(text()) return ../../../efac:SettledContract/cbc:AwardDate[../efac:LotTender/cbc:ID/normalize-space(text()) = $tender2]/xs:date(text()), '[D01]/[M01]/[Y0001]')"/>

The error StackTrace:

18:07:03.584 [main] DEBUG e.e.t.e.v.generator.XslGenerator - Successfully created XSL for SDK version [1.9].
18:07:03.783 [main] DEBUG e.e.t.e.v.generator.HtmlGenerator - Writing HTML for view ID [29] to file [build\output-html\29-fr.html]
18:07:03.784 [main] DEBUG e.e.t.e.v.generator.HtmlGenerator - Creating XSL transformer factory
18:07:04.025 [main] DEBUG e.e.t.e.v.generator.HtmlGenerator - Successfully created XSL transformer factory
18:07:04.026 [main] DEBUG e.e.t.e.v.generator.HtmlGenerator - Creating XSL transformer for language [fr] and view ID [29]
18:07:06.481 [main] DEBUG e.e.t.e.v.generator.HtmlGenerator - Successfully created XSL transformer for language [fr] and view ID [29]
18:07:06.481 [main] DEBUG e.e.t.e.v.generator.HtmlGenerator - Applying XSL transformation for language [fr] and view ID [29]
18:07:07.633 [main] ERROR e.e.ted.eforms.viewer.Application - Error executing the application with arguments [[fr, .\24-12190_XML_EFORM.xml]]. Please see the logs.
18:07:07.635 [main] DEBUG e.e.ted.eforms.viewer.Application - Exception thrown:
net.sf.saxon.trans.XPathException: A sequence of more than one item is not allowed as the first argument of fn:format-date() (xs:date("2024-01-12+02:00"), xs:date("2024-01-12+02:00")) 
	at net.sf.saxon.expr.Expression.typeError(Expression.java:1477)
	at net.sf.saxon.expr.CardinalityChecker.evaluateItem(CardinalityChecker.java:296)
	at net.sf.saxon.expr.parser.Evaluator$OptionalItem.evaluate(Evaluator.java:201)
	at net.sf.saxon.expr.SystemFunctionCall.evaluateArguments(SystemFunctionCall.java:469)
	at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:560)
	at net.sf.saxon.expr.Expression.process(Expression.java:948)
	at net.sf.saxon.expr.SystemFunctionCall.process(SystemFunctionCall.java:496)
	at net.sf.saxon.expr.instruct.ValueOf.processLeavingTail(ValueOf.java:345)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:755)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:384)
	at net.sf.saxon.expr.instruct.ForEach.lambda$processLeavingTail$0(ForEach.java:531)
	at net.sf.saxon.om.SequenceTool.supply(SequenceTool.java:147)
	at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:531)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:755)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:384)
	at net.sf.saxon.expr.instruct.ForEach.lambda$processLeavingTail$0(ForEach.java:531)
	at net.sf.saxon.om.SequenceTool.supply(SequenceTool.java:147)
	at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:531)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:755)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:384)
	at net.sf.saxon.expr.instruct.ForEach.lambda$processLeavingTail$0(ForEach.java:531)
	at net.sf.saxon.om.SequenceTool.supply(SequenceTool.java:147)
	at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:531)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:755)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:384)
	at net.sf.saxon.expr.instruct.ForEach.lambda$processLeavingTail$0(ForEach.java:531)
	at net.sf.saxon.om.SequenceTool.supply(SequenceTool.java:147)
	at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:531)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:755)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:384)
	at net.sf.saxon.expr.instruct.ForEach.lambda$processLeavingTail$0(ForEach.java:531)
	at net.sf.saxon.om.SequenceTool.supply(SequenceTool.java:147)
	at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:531)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:755)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
	at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:384)
	at net.sf.saxon.expr.instruct.ForEach.lambda$processLeavingTail$0(ForEach.java:531)
	at net.sf.saxon.om.SequenceTool.supply(SequenceTool.java:147)
	at net.sf.saxon.expr.instruct.ForEach.processLeavingTail(ForEach.java:531)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
	at net.sf.saxon.expr.instruct.Instruction.process(Instruction.java:142)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:357)
	at net.sf.saxon.expr.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:392)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:551)
	at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:685)
	at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:421)
	at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:353)
	at net.sf.saxon.jaxp.TransformerImpl.transform(TransformerImpl.java:75)
	at eu.europa.ted.eforms.viewer.generator.HtmlGenerator.applyXslTransformation(HtmlGenerator.java:212)
	at eu.europa.ted.eforms.viewer.generator.HtmlGenerator.generateFile(HtmlGenerator.java:109)
	at eu.europa.ted.eforms.viewer.NoticeViewer.generateHtmlFile(NoticeViewer.java:131)
	at eu.europa.ted.eforms.viewer.NoticeViewer.generateHtmlFile(NoticeViewer.java:103)
	at eu.europa.ted.eforms.viewer.cli.CliCommand.call(CliCommand.java:113)
	at eu.europa.ted.eforms.viewer.cli.CliCommand.call(CliCommand.java:37)
	at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at eu.europa.ted.eforms.viewer.Application.main(Application.java:35)

I also tested with the API from https://viewer.preview.ted.europa.eu/api/v2/notices/render and I have the same problem, the HTML is incomplete, although the API returns a 200.

Thanks in advance.

@rousso
Copy link
Contributor

rousso commented Feb 13, 2024

Noted @doc-yh. We will provide an update of the EFX Toolkit that addresses this.
Thank you.

@rousso
Copy link
Contributor

rousso commented Feb 13, 2024

Hi again @doc-yh,

The bug is actually in the EFX Toolkit. I added a fix in this branch.

We will test it tomorrow and release a new version of the EFX Toolkit asap. If you know how to build the eForms Notice Viewer using a branch from the EFX Toolkit, then you are welcome to also test it yourself and let me know if it works for you. Otherwise, I will let you know here as soon as the releases are done.

Yannis

@doc-yh
Copy link
Author

doc-yh commented Feb 14, 2024

Hello @rousso,

Thank you for solving the problem. I ran a test and it works perfectly.

Thank you very much.

@rousso
Copy link
Contributor

rousso commented Feb 16, 2024

Hello again @doc-yh,

The fix has been released with eForms Notice Viewer 0.10.1 and EFX Toolkit 2.0.0-alpha.3.
As I explained in my previous message the actual fix is in the EFX Toolkit. The Notice Viewer was release only to update its dependency to the latest version of the EFX Toolkit.

Thank you for your help in spotting and fixing this issue.
Yannis

cc: @gdranSpike

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 a pull request may close this issue.

2 participants