Project

Profile

Help

XSLT 3 compiles with Saxon Java EE 10.5 but Saxon-JS 2 gives error Error Q{http://www.w3.org/2005/xqt-errors}XTSE0350 at XSLT-value-template.xsl#55 Missing closing brace after expression:{

Added by Martin Honnen over 3 years ago

While trying to xslt3 of Saxon-JS with Node on a rather complex XSLT stylesheet with lots of includes and imports and text templates I got an error

xslt3 -t -xsl:highlight-doc-test1.xsl -nogo -export:highlight-doc-test1.sef.json
Saxon-JS 2.2 from Saxonica
Node.js version v12.18.0
Compiling stylesheet C:\Users\Martin Honnen\IdeaProjects\xmlspectrum\app\samples\xslt3\highlight-doc-test1.xsl
Failed to compile stylesheet: Missing closing brace after expression:{
Error Q{http://www.w3.org/2005/xqt-errors}XTSE0350 at XSLT-value-template.xsl#55
    Failed to compile stylesheet:
Error Q{http://www.w3.org/2005/xqt-errors}XTSE0350 at XSLT-value-template.xsl#55
    Missing closing brace after expression:{

When I use Saxon EE 10.5 Java to compile for target:JS it compiles fine.

If the above doesn't suffice to identify whether/where there is an issue in the xslt3 compiler in XSLT-value-template.xsl#55 I willl later try to create a hopefully more simple but complete repro.


Replies (3)

Please register to reply

RE: XSLT 3 compiles with Saxon Java EE 10.5 but Saxon-JS 2 gives error Error Q{http://www.w3.org/2005/xqt-errors}XTSE0350 at XSLT-value-template.xsl#55 Missing closing brace after expression:{ - Added by Martin Honnen over 3 years ago

So I have managed to isolate the problem, it is caused by a main XSLT module having expand-text="yes" importing a module not having that setting but using an opening curly brace {, for instance the main module is

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="3.0"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="#all"
    expand-text="yes">
    
    <xsl:import href="include-without-expand-text1.xsl"/>
    
    <xsl:mode on-no-match="shallow-copy"/>
    
    <xsl:template match="/" name="xsl:initial-template">
        <xsl:next-match/>
        <xsl:comment xmlns:saxon="http://saxon.sf.net/">Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
    </xsl:template>
    
</xsl:stylesheet>

the import is

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="#all"
    version="3.0">
    
    <xsl:template match="data">
        <xsl:copy>
            <span><xsl:text>{</xsl:text></span>
            <span>
                <xsl:value-of select="."/>
            </span>
            <span><xsl:text>}</xsl:text></span>
        </xsl:copy>
    </xsl:template>
    
</xsl:stylesheet>

and the xslt3 gives the error for the <span><xsl:text>{</xsl:text></span> while Saxon Java doesn't.

Input is e.g.

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <data>a &lt; b</data>
    <data>{a &lt; b}</data>
</root>

RE: XSLT 3 compiles with Saxon Java EE 10.5 but Saxon-JS 2 gives error Error Q{http://www.w3.org/2005/xqt-errors}XTSE0350 at XSLT-value-template.xsl#55 Missing closing brace after expression:{ - Added by Michael Kay over 3 years ago

Thanks for the repro. By the looks of it, It's related to https://saxonica.plan.io/issues/5008 - specifically, it appears to be caused by losing the stylesheet-level attributes such as expand-text when declarations in an included or imported module are merged into the parent module. In this case it might be relevant that the attribute in question, expand-text="no", is implicit as the default rather than being explicitly specified.

RE: XSLT 3 compiles with Saxon Java EE 10.5 but Saxon-JS 2 gives error Error Q{http://www.w3.org/2005/xqt-errors}XTSE0350 at XSLT-value-template.xsl#55 Missing closing brace after expression:{ - Added by Martin Honnen over 3 years ago

I can confirm that importing a module that explicitly has expand-text="no" works fine with Saxon-JS 2 and xslt3.

But it is hard to fix all includes and imports of a originally XSLT 2 based project where expand-text was not used and didn't exist.

    (1-3/3)

    Please register to reply