OK,

in my case, as a workaround, I can  replace the XSLT variable declaration with let expression, which works.

Just for my calm – the way I use free variables in inline functions – expect them to be bound to variables defined in the context where the function item is created – that is supposed to work, right?


Jakub.

 

From: Michael Kay [mailto:mike@saxonica.com]
Sent: Wednesday, February 22, 2012 12:32 PM
To: saxon-help@lists.sourceforge.net
Subject: Re: [saxon] Saxon gives NullPointerException when parsing XPath expression

 

I'm afraid this is not so much a bug as a not-implemented-feature. The code for parsing inline functions in XPath simply isn't handling the case where there is a reference to a local variable declared as an XSLT local variable rather than being declared at an outer level in the same XPath expression.

I know why it isn't working; I now need to look at whether the solution can be implemented as a patch.

Michael Kay
Saxonica



On 21/02/2012 15:06, Jakub Malư wrote:

Hi, 
Saxon is giving NullPointerException in my stylesheet (attached with input
data)
I hope the stylesheet is correct, though I am not 100% sure. The lines 19-50
are important and Saxon is failing to parse the following XPath expression: 
 
<xsl:variable name="self" as="item()" select="current()"/>
...
my:checked(function() { my:forAll($self/matches/day/match, function($m) {
$m/start eq $self/start} ) } )
 
It is the variable self, which makes trouble. I hope I did unterstand the
specification correctly regarding free variables in HOF. The variable self
is free both in the function passed to the first HOF (checked) and second
HOF (forAll). In the first function, self is bound correctly, but in the
second, the exception is thrown. When I change the line to this
(meaningless):  
 
my:checked(function() { my:forAll($self/matches/day/match, function($m) {
$m/start eq $m/start} ) } )
 
It works. 
 
________________________________________
 
Jakub Malư 
 
Ph. D. candidate
XML Research Group
Department of Software Engineering
Faculty of Mathematics and Physics
Charles University in Prague, Czech Republic
www.jakubmaly.cz 
 
 




------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d




_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help