Project

Profile

Help

Bug #6061

Updated by Michael Kay 11 months ago

I’m evaluating SaxonCS 12.2. When I do a transform using SaxonCS.exe with the attached XSLT I get the error below. It happens when the XSLT contains a regular expression with the “;n” flag (i.e. using the .net regex engine). In the example I use analyze-string, but I can reproduce this with other regex-methods as well. It works without the “;n” flag. 
 
 <xsl:analyze-string select="." regex="a" flags=";n"> 
 
 
 ``` 
 Saxon license expires in 19 days 
 System.ArgumentOutOfRangeException: Length cannot be less than zero. (Parameter 'length') 
    at System.String.Substring(Int32 startIndex, Int32 length) 
    at Saxon.Hej.regex.JRegexIterator.next() 
    at Saxon.Hej.om.FocusTrackingIterator.next() 
    at Saxon.Hej.expr.instruct.AnalyzeString.AnalyzeStringElaborator.<>c__DisplayClass1_0.<elaborateForPush>b__0(Outputter out, XPathContext context) 
    at Saxon.Hej.expr.instruct.Copy.CopyElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter output, XPathContext context) 
    at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context) 
 System.Exception: Internal error evaluating template rule    at line 14 in module file:///D:/Temp/saxontest/template.xslt 
 ---> System.ArgumentOutOfRangeException: Length cannot be less than zero. (Parameter 'length') 
    at System.String.Substring(Int32 startIndex, Int32 length) 
    at Saxon.Hej.regex.JRegexIterator.next() 
    at Saxon.Hej.om.FocusTrackingIterator.next() 
    at Saxon.Hej.expr.instruct.AnalyzeString.AnalyzeStringElaborator.<>c__DisplayClass1_0.<elaborateForPush>b__0(Outputter out, XPathContext context) 
    at Saxon.Hej.expr.instruct.Copy.CopyElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter output, XPathContext context) 
    at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context) 
    --- End of inner exception stack trace --- 
    at Saxon.Hej.expr.instruct.TemplateRule.applyLeavingTail(Outputter output, XPathContext context) 
    at Saxon.Hej.trans.Mode.handleRuleNotNull(Rule rule, TraceListener traceListener, XPathContextMajor context, Item item, TemplateRule previousTemplate, ParameterSet parameters, ParameterSet tunnelParameters, Outputter output) 
    at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId) 
    at Saxon.Hej.trans.rules.ShallowCopyRuleSet.process(Item item, ParameterSet parameters, ParameterSet tunnelParams, Outputter out, XPathContext context, Location locationId) 
    at Saxon.Hej.trans.Mode.applyTemplates(ParameterSet parameters, ParameterSet tunnelParameters, NodeInfo separator, Outputter output, XPathContextMajor context, Location locationId) 
    at Saxon.Hej.trans.XsltController.applyTemplates(Sequence source, Receiver out) 
    at Saxon.Hej.s9api.AbstractXsltTransformer.applyTemplatesToSource(Source source, Receiver out) 
    at Saxon.Hej.s9api.Xslt30Transformer.applyTemplates(Source source, Destination destination) 
    at Saxon.Hej.Transform.processFile(Source source, XsltExecutable sheet, File outputFile, CommandLineOptions options) 
    at Saxon.Hej.Transform.doTransform(String[] args) 
 Fatal error during transformation: Exception: Internal error evaluating template rule    at line 14 in module file:///D:/Temp/saxontest/template.xslt 
 Exiting with code 2 
 ``` 
 

Back