This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
<xsl:number from=...> different behavior (MSXML3 vs saxon etc.)
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] <xsl:number from=...> different behavior (MSXML3 vs saxon etc.)
- From: MURAKAMI Shinyu <murakami at nadita dot com>
- Date: Fri, 20 Apr 2001 14:51:34 +0900
- Reply-To: xsl-list at lists dot mulberrytech dot com
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