Re: [xsl] How do I do this?

Subject: Re: [xsl] How do I do this?
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 21 Aug 2002 18:08:21 -0600 (MDT)
David N Bertoni/Cambridge/IBM wrote:
> > By the way, why does adding format="{{1}}" produce the number enclosed in
> > single curly braces unless the number is 0, while format="{1}" seems to
> be no
> > different than format="1"? format="[1]" works as expected, so what rule
> in the
> > spec am I overlooking?
> 
> The format attribute is an AVT, so you need {{1}} to get {1}.

Ah, it is an AVT. I missed this because it wasn't explicitly stated as such,
except in the summary where it says
  format = { string }
(the curly braces indicating it is an AVT).

So, then, it is a bug that with format="{{1}}", Saxon will produce "0" when
the generated number is 0, but will wrap any other number in curly braces?

> > And why is <xsl:number/> treated differently
> > than <xsl:number value="position()"/> 
> [...] 
> You're right, it does seem vague, or least it's mixing terminology.  I've
> always interpreted this as the position in the document (as in document
> order).  Does that make sense?

Not really, because I still think of position as being relative to something.  
Its position "in the document" makes me think it's relative to something like 
the document-ordered set //node() or even 
( //node() | //node()/@* |  //node()/namespace::* ). I think it is relative
to something, but that something is dependent upon level, count, and from,
which haven't been explained yet.

Even Mike Kay's book (1st edition) doesn't really help much in this regard.

> Perhaps a more explicit and long-winded description would be better?

Well, I'd just rather see the terminology, especially w.r.t. "position", be
more accurate, and more examples provided. I mean, you gotta admit, that 2nd
paragraph under 'Number to String Conversion Attributes' is a doozie, and
there aren't enough examples.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread