Subject: RE: [xsl] Answers to review questions in "Beginning XSLT": Chapter 9 From: "Lars Huttar" <lars_huttar@xxxxxxx> Date: Thu, 20 Mar 2003 12:03:05 -0600 |
Hi Jeni, and by the way thanks for your response to ch. 8. > The sorting in document order of those elements that have the same > sort key is guaranteed. OK. Good to know. > > 6. What two ways can you use to generate a number giving the position > > of a node within the source tree? > > > > Answer: > > position() and <xsl:number>. > > position() will only work if you're processing the nodes in document > order. Can you think of another way that will work even if you're > processing the nodes in a different order? Hmmm... How about <xsl:value-of select="count(preceding-sibling::Myname) + 1" /> where Myname is the name of this element. And if you wanted position regardless of level, change the axis to preceding::. > > (Side note: out of curiosity, > > I tried adding in a fourth format using Unicode Khmer digit one, > > ១. XSLT Programmer's Reference says any Unicode digit one > > should work. Saxon processed it properly, generating ៣ (Khmer > > digit three) for the third item; but IE/MSXML didn't seem to > > recognize ១ as a digit.) > > Hmm... I think that MSXML is non-conformant in that case. The XSLT > spec says: > > "Any token where the last character has a decimal digit value of 1 > (as specified in the Unicode character property database)... > generates a decimal representation of the number..." > > KHMER DIGIT ONE (#x17E1) has a decimal digit value of 1 in the Unicode > character property database, so it should be recognised. For the format "<១>", MSXML generated "<១>3<១>", i.e. apparently treating the ១ as part of a punctuation token, and putting the whole formatting string before and after the number 3. I tried this with MSXSL on the command-line as well as in IE, with the same result. It would be nice if IE would let you specify whatever external XSL processor you wanted to run... I would like to run Saxon by default. Lars XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Answers to review questio, Jeni Tennison | Thread | [xsl] seriously trivial question ab, Robert P. J. Day |
RE: [xsl] what does "AW:" mean?, Wendell Piez | Date | RE: [xsl] what does "AW:" mean? (OT, Lars Huttar |
Month |