[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: current()/self::* vs "."

Subject: RE: current()/self::* vs "."
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 26 Oct 2007 09:22:38 +0100
RE:  current()/self::* vs "."
Saxon is implementing XPath 2.0, the others are implementing XPath 1.0. For
some reason (almost certainly an oversight), the XPath 1.0 grammar does not
allow "." or ".." to be followed by a predicate. (Although "." is defined
semantically as an abbreviation for self::node(), the syntax is such that it
cannot appear in all contexts where self::node() can appear. This was fixed
in 2.0.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Alan Stroop [mailto:alan.stroop@xxxxxxxxx] 
> Sent: 26 October 2007 00:35
> To: xsl-list
> Subject:  current()/self::* vs "."
> 
> 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.
> 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 "."?  
> Following is a simplified version of the stylesheet and source xml:
> 
> XSL:
> <xsl:stylesheet 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> 
> <!--
> Template Name: bugtester.xsl
> Author:        Alan Stroop
> -->
> 
>     <xsl:template match="mcijis">
>         <xsl:call-template name="IJISComplaint"/>
>     </xsl:template>
> 
>     <xsl:template name="IJISComplaint">
>         <Complaint>
>             <xsl:apply-templates/>
>         </Complaint>
>     </xsl:template>
> 
>     <xsl:template match="complaintant">
>         <CaseInitiatingParty.Person >
>             <!-- change . to current(), self::*, self::node() 
> or self::complaintant -->
>             <xsl:apply-templates select=".[not(@alias) or 
> @alias!='true'] " mode="personname" />
>         </CaseInitiatingParty.Person>
>     </xsl:template>
> 
>     <xsl:template match="complaintant" mode="personname">
>         <PersonName>
>             <xsl:value-of select="concat(first,' ',last)"/>
>         </PersonName>
>     </xsl:template>
> 
> </xsl:stylesheet>
> 
> XML:
> <mcijis>
>     <complaintant>
>         <last>Roberts</last>
>         <first>Bob</first>
>     </complaintant>
> </mcijis>
> 
> Can someone fill me in on what I could be missing or why 
> Saxon seems to be the only voice of reason?
> 
> Thanks
> 
> --
> <alan/>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.