Re: [xsl] xsl:number on attribute nodes..

Subject: Re: [xsl] xsl:number on attribute nodes..
From: Jack Matheson <jack@xxxxxxxxxxxxxx>
Date: Tue, 9 Aug 2005 11:18:56 -0500
Your presumption was correct. The input document responsible for those results was:

<empty a="1"/>

I also noticed that Saxon8 produces no error, but I am only concerned with XSLT 1.0 at this point.
I'm not familiar with XSLT 2.0 at all...is there something in that spec which clarifies this issue and hopefully explains the output
difference in the two versions of Saxon?


Thanks for the speedy reply,
-Jack


For once, i think i'd go with xalan here. (two counts of 1, not one of 11, presumably on a document with one element node with one attribute?)

You have a count attribute and an (implied) level="single"
so the system should start by going


"goes up to the first node in the ancestor-or-self axis that matches
the count pattern"


which in this case will give the element holding the attribute, and
count that.

Note I think the xslt1 spec is badly worded in this case if you use
level="multiple" as it says "followed by the element itself;" implying
that the current node is an element.


Note saxon8 handles your stylesheet differently, running your posted code on itself produces:


$ saxon num.xsl num.xsl Error at xsl:number on line 9 of file:/c:/tmp/num.xsl: Attribute nodes cannot be numbered Transformation failed: Run-time errors were reported


$ saxon8 num.xsl num.xsl Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor <?xml version="1.0" encoding="UTF-8"?>1111112111



David

______________________________________________________________________ __
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
______________________________________________________________________ __

Current Thread