RE: [xsl] <xsl:number from=...> different behavior (MSXML3 vs saxon etc.)

I agree with you: I think the current wording is unclear (and it's not fixed
by Erratum E12 either) and the behavior is therefore unspecified. I'm
forwarding the note to xsl-editors so it can be reviewed by the WG.

Mike Kay

> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of MURAKAMI
> Shinyu
> Sent: 20 April 2001 06:52
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] <xsl:number from=...> different behavior
> (MSXML3 vs saxon
> etc.)
>
>
> I found a problem about interpretation of <xsl:number from=...>.
> See the following example.
>
> --------------- test.xsl ------------------------
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                 version="1.0">
>   <xsl:template match="/">
>     <html>
>       <body>
>         <xsl:apply-templates/>
>       </body>
>     </html>
>   </xsl:template>
>
>   <xsl:template match="part/title">
>     <h1>
>       <xsl:number from="book" count="part" level="any" format="I"/>
>       <xsl:text> </xsl:text>
>       <xsl:apply-templates/>
>     </h1>
>   </xsl:template>
>
>   <xsl:template match="chapter/title">
>     <h2>
>       <xsl:number from="part" count="chapter" level="any" format="1"/>
>       <xsl:text> </xsl:text>
>       <xsl:apply-templates/>
>     </h2>
>   </xsl:template>
>
> </xsl:stylesheet>
> -------------------------------------------------
>
> This test.xsl works well for documents having both <part> and
> <chapter>,
> but if there is no <part> elements, what should be returned by
> <xsl:number from="part" .../>?
> (The XSLT spec seems unclear about this)
>
> --------------- test.xml ------------------------
> <book>
>   <chapter><title>Uno</title>
>     ...
>   </chapter>
>   <chapter><title>Dos</title>
>     ...
>   </chapter>
>   <chapter><title>Tres</title>
>     ...
>   </chapter>
>   <chapter><title>Cuatro</title>
>     ...
>   </chapter>
> </book>
> -------------------------------------------------
>
> --------------- MSXML3 output ------------------------
> <html>
>   <body>
>     <h2>0 Uno</h2>
>     ...
>     <h2>0 Dos</h2>
>     ...
>     <h2>0 Tres</h2>
>     ...
>     <h2>0 Cuatro</h2>
>     ...
>   </body>
> </html>
> ------------------------------------------------------
>
> --------------- SAXON output ------------------------
> <html>
>   <body>
>     <h2>1 Uno</h2>
>     ...
>     <h2>2 Dos</h2>
>     ...
>     <h2>3 Tres</h2>
>     ...
>     <h2>4 Cuatro</h2>
>     ...
>   </body>
> </html>
> -----------------------------------------------------
>
> Which is correct?
>
> ~~Shinyu
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>

Received on Monday, 23 April 2001 18:04:05 UTC