[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

<xsl:number from=...> different behavior (MSXML3 vs sa

Subject: <xsl:number from=...> different behavior (MSXML3 vs saxon etc.)
From: MURAKAMI Shinyu <murakami@xxxxxxxxxx>
Date: Fri, 20 Apr 2001 14:51:34 +0900
murakami part number
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.