Support #1689
closedname() within an inline function
0%
Description
From xsl:list, today:
I tested using the following code in oXygen 14.1 with Saxon 9.4.0.4.
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ahf="http://www.yahoo.co.jp/tmakita">
<xsl:template match="root">
<xsl:variable name="slectFunc" as="function(*)"
select="ahf:funcGetChildElementByName('d')"/>
<xsl:sequence select="$slectFunc(.)"/>
</xsl:copy>
</xsl:template>
<xsl:function name="ahf:funcGetChildElementByName" as="function(*)">
<xsl:param name="prmElemName" as="xs:string"/>
<xsl:sequence select="function($a as element()) as element()*
{$a/child::*[starts-with(name(),$prmElemName)]}"/>
</xsl:function>
</xsl:stylesheet>
However Saxon returns following error.
System ID: D:\My Documents\Proj\XSLT-TEST\20130113-func\test.xsl
Main validation file: D:\My Documents\Proj\XSLT-TEST\20130113-func\test.xsl
Engine name: Saxon-EE 9.4.0.4
Severity: error
Description: 0
Is there any workarounds?
Regards,
Toshihiko Makita
It's a NullPointerException in NameFn, and a workaround is to use name(.) instead of name(). It seems the context item isn't being supplied as an implicit argument. Works OK on the 9.5 branch.
Updated by Michael Kay over 11 years ago
- Tracker changed from Bug to Support
- Status changed from New to Duplicate
The stacktrace in 9.4.0.4 starts:
java.lang.ArrayIndexOutOfBoundsException: 0
at net.sf.saxon.functions.NameFn.evaluateItem(NameFn.java:33)
at net.sf.saxon.expr.Expression.iterate(Expression.java:429)
at net.sf.saxon.expr.FunctionCall.preEvaluate(FunctionCall.java:199)
at net.sf.saxon.expr.FunctionCall.typeCheck(FunctionCall.java:137)
The problem appears to have been fixed in Saxon 9.4.0.6, though I haven't identified the specific bug fix that cured the problem.
Michael Kay
Saxonica
Please register to edit this issue