Project

Profile

Help

Bug #1933

closed

NullPointerException when current() used in a pattern predicate

Added by Adrian Buza about 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2013-11-06
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

When running this stylesheet (XML input is not relevant) with Saxon-EE 9.5.0.2 and later (also tested with 9.5.1.3)

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:my="my"
    exclude-result-prefixes="xs my"
    version="2.0">
    
    <xsl:function name="my:test" as="xs:boolean">
        <xsl:param name="elt" as="node()" />
        <xsl:param name="ancestor-elt" as="element(*)" />
        <xsl:sequence select="true()"/>
    </xsl:function>
    
    <xsl:template match="A[B[my:test(., current())]]"/>
    

the result is the following stack trace (this is from 9.5.1.3):

        at net.sf.saxon.expr.UserFunctionCall.computeArgumentEvaluationModes(UserFunctionCall.java:346)
        at net.sf.saxon.expr.UserFunctionCall.replaceSubExpression(UserFunctionCall.java:371)
        at net.sf.saxon.pattern.Pattern.replaceCurrent(Pattern.java:83)
        at net.sf.saxon.pattern.Pattern.replaceCurrent(Pattern.java:85)
        at net.sf.saxon.pattern.PatternWithPredicate.bindCurrent(PatternWithPredicate.java:44)
        at net.sf.saxon.style.StyleElement.typeCheck(StyleElement.java:1257)
        at net.sf.saxon.style.XSLTemplate.validate(XSLTemplate.java:274)
        at net.sf.saxon.style.StyleElement.validateSubtree(StyleElement.java:1361)
        at net.sf.saxon.style.PrincipalStylesheetModule.preprocess(PrincipalStylesheetModule.java:275)
        at net.sf.saxon.PreparedStylesheet.setStylesheetDocument(PreparedStylesheet.java:378)
        at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:236)
        at net.sf.saxon.PreparedStylesheet.compile(PreparedStylesheet.java:114)
        at net.sf.saxon.Transform.doTransform(Transform.java:565)
        at net.sf.saxon.Transform.main(Transform.java:82)

Related issues

Related to Saxon - Bug #1942: Function current should have been resolved at compile timeClosedMichael Kay2013-12-02

Actions

Please register to edit this issue

Also available in: Atom PDF