Re: [xsl] xsl::number from current note

Subject: Re: [xsl] xsl::number from current note
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 20 May 2004 21:11:50 +0100
Hi Ming,

> Do you know what's the difference between
> <xsl:number level="single" from="*" count="SEC" format="1. "/>
> and
> <xsl:number level="single" from="." count="SEC" format="1. "/>
>
> The second one sometimes does not work by giving error message:
>
> XSLException Type is: XPathParserException
> Message is: Expected node test.
> pattern = '.'
> Remaining tokens: ('.')

The value of the from attribute should be an *XSLT pattern* -- the
same kind of value as that held in the match attribute of
<xsl:template>. The purpose of patterns is to test nodes based on
their kind, name, ancestry and so on. In this case, the pattern held
by the from attribute is used to test all the ancestors of the node
you're on (the context node), and you get numbering within the closest
ancestor that matches that pattern. In this case, the pattern "*"
matches all elements, so you get numbering within the parent element
of the node you're on (which is presumably a <SEC> element).

The value "." is a *XPath expression* (that selects the context node).
It isn't a legal XSLT pattern, which is why you're getting the error
message.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Current Thread