Bug #5372
closedSaxonC HE fails to compile XSLT stylesheets using Unicode categories as it fails to find the categories.xml file during compilation
100%
Description
As reported in https://stackoverflow.com/questions/71362331/saxon-c-he-11-2-prints-empty-output-when-xslt-has-an-include-or-using-xslresu, SaxonC 11.2 HE fails to compile a stylesheet using regular expressions and Unicode categories. Saxon C 11.2 EE, on the other hand, compiles and executes the code fine, so I presume that due to a build problem, the SaxonC HE release does not have the categories.xml or does not look in the right place.
Simple stylesheet that does not work with HE:
<?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:template name="xsl:initial-template">
<test>{replace('abc12def', '\d' , '')}</test>
</xsl:template>
</xsl:stylesheet>
When I run that with transform -t -it
the output for HE is only
SaxonC-HE 11.2 from Saxonica
Java version 1.8.0_181
so it fails during compilation, meanwhile EE outputs
SaxonC-EE 11.2 from Saxonica
Java version 1.8.0_181
Stylesheet compilation time: 54.4433ms
Processing (no source document) initial template = xsl:initial-template
<?xml version="1.0" encoding="UTF-8"?><test>abcdef</test>Execution time: 2.074ms
Memory used: 13Mb
Looking at the error output from stylesheet compilation with HE the stack trace shows
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.sf.saxon.regex.RECompiler.escape(Unknown Source)
at net.sf.saxon.regex.RECompiler.parseTerminal(Unknown Source)
at net.sf.saxon.regex.RECompiler.piece(Unknown Source)
at net.sf.saxon.regex.RECompiler.parseBranch(Unknown Source)
at net.sf.saxon.regex.RECompiler.parseExpr(Unknown Source)
at net.sf.saxon.regex.RECompiler.compile(Unknown Source)
at net.sf.saxon.regex.ARegularExpression.<init>(Unknown Source)
at net.sf.saxon.java.JavaPlatform.compileRegularExpression(Unknown Source)
at net.sf.saxon.Configuration.compileRegularExpression(Unknown Source)
at net.sf.saxon.functions.RegexFunction.tryToBindRegularExpression(Unknown Source)
at net.sf.saxon.functions.RegexFunction.makeFunctionCall(Unknown Source)
at net.sf.saxon.functions.Replace.makeFunctionCall(Unknown Source)
at net.sf.saxon.functions.RegexFunctionSansFlags.makeFunctionCall(Unknown Source)
at net.sf.saxon.functions.registry.BuiltInFunctionSet.bind(Unknown Source)
at net.sf.saxon.functions.FunctionLibraryList.bind(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseFunctionCall(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseBasicStep(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseStepExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseRelativePath(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parsePathExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseSimpleMappingExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseUnaryExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseExprSingle(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseFunctionCall(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseBasicStep(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseStepExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseRelativePath(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parsePathExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseSimpleMappingExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseUnaryExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseExprSingle(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parseExpression(Unknown Source)
at net.sf.saxon.expr.parser.XPathParser.parse(Unknown Source)
at net.sf.saxon.expr.parser.ExpressionTool.make(Unknown Source)
at net.sf.saxon.style.StyleElement.makeExpression(Unknown Source)
at net.sf.saxon.style.XSLSequence.prepareAttributes(Unknown Source)
at net.sf.saxon.style.StyleElement.<unknown>(Unknown Source)
at net.sf.saxon.style.StyleElement.processAllAttributes(Unknown Source)
at net.sf.saxon.style.StyleElement.processAllAttributes(Unknown Source)
at net.sf.saxon.style.PrincipalStylesheetModule.processAllAttributes(Unknown Source)
at net.sf.saxon.style.PrincipalStylesheetModule.preprocess(Unknown Source)
at net.sf.saxon.style.Compilation.compilePackage(Unknown Source)
at net.sf.saxon.style.StylesheetModule.loadStylesheet(Unknown Source)
at net.sf.saxon.style.Compilation.compileSingletonPackage(Unknown Source)
at net.sf.saxon.s9api.XsltCompiler.compile(Unknown Source)
at net.sf.saxon.option.cpp.Xslt30Processor.getXslt30Transformer(Unknown Source)
at net.sf.saxon.option.cpp.Xslt30Processor.transformToFile(Unknown Source)
Caused by: java.lang.RuntimeException: Unable to read categories.xml file
at net.sf.saxon.regex.charclass.Categories.build(Unknown Source)
at net.sf.saxon.regex.charclass.Categories.getCategory(Unknown Source)
at net.sf.saxon.regex.charclass.Categories.<clinit>(Unknown Source)
... 47 more
so that clearly indicates that compilation fails as categories.xml can't be found.
Updated by O'Neil Delpratt over 2 years ago
Thanks Martin. This looks like the cause of the failure.
Updated by O'Neil Delpratt over 2 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Bug fix applied in the gradle build-c file for both HE and PE. Patch available in the maintenance release.
Updated by O'Neil Delpratt over 2 years ago
- Status changed from Resolved to Closed
- Fixed in version set to 11.3
Bug fix applied in the SaxonC 11.3 maintenance release.
Please register to edit this issue