Re: [xsl] current()/self::* vs "."

Subject: Re: [xsl] current()/self::* vs "."
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Oct 2007 19:40:19 -0400
At 2007-10-25 17:35 -0600, Alan Stroop wrote:
I've recently run into an issue where the self:: axis abbreviation "."
didn't work as expected when trying to apply-templates to the current
node.  The stylesheet was tested against Saxon8.9b, Xalan-J, Xalan-C
and MSXML with Saxon being the only one that didn't have an issue.

Saxon is the only one in that list supporting XSLT 2.0 ... that's a clue!


Errors returned were syntax errors to could not compile stylesheet.  I
was able to get the stylesheet to work in all processors by using
current() or self::* or self::node() instead of the self::
abbreviation.

I find it hard to believe that the same bug is found in the three
failing processors, but stranger things have happened.  Does Mr. Kay
have some insider knowledge that the authors of the other processors
do not about the intricacies of "."?

In XSLT 1.0 "." is not allowed to have predicates, while in XSLT 2.0 "." is allowed to have predicates.


Following is a simplified version of the stylesheet and source xml:
...
 <xsl:apply-templates select=".[not(@alias) or
                                @alias!='true'] " mode="personname" />
...
Can someone fill me in on what I could be missing or why Saxon seems
to be the only voice of reason?

Running an XSLT 1.0 stylesheet in an XSLT 2.0 processor does not restrict the XPath addresses but it does change some of the return results from using XPath address.


I hope this helps.

. . . . . . . . . Ken

--
Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Jul'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread