[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: [xsl] current()/self::* vs "."
From: "Alan Stroop" <alan.stroop@xxxxxxxxx>
Date: Thu, 25 Oct 2007 17:35:01 -0600

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