You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Dominik Reichardt <do...@gmail.com> on 2010/08/16 04:23:29 UTC

xsl:number value problem with Xalan-j since 2.7.0

Hi all,

I'm new to this list so please forgive me any faux-pas and please correct me if necessary.

My problem:

I'm maintaining the Documentation and FAQ for the game engine project Exult (http://exult.sf.net). For years I've used a combination of xml and xsl files to generate the html, php and text versions of our documentation.
On top of our documentation we provide a changelog with which we begin numbering our chapters/sections but since it is only the changes we start at 0 by doing:

<xsl:template name="TOC">
	<xsl:for-each select="section">
		<xsl:number level="multiple"
					count="section"
					format="1. "
					value="position() -1"/>
		<xsl:value-of select="@title"/><xsl:text>&#xA;</xsl:text>


When using xalan-j 2.6.0 this gives me a result which looks like

-------------------
0. Changes to the Documentation
0.1. - 15 August 2010
0.2. - 28 April 2010
.
.
.

1. Introduction
1.1. Exult Version
1.2. What is Exult?
1.3. Terms we use in regard to Exult and Ultima 7
.
.
.
-------------------


But when I use xalan-j 2.7.0 or 2.7.1 I get 

-------------------
0Changes to the Documentation
01. - 15 August 2010
02. - 28 April 2010
.
.
.

1. Introduction
1.1. Exult Version
1.2. What is Exult?
1.3. Terms we use in regard to Exult and Ultima 7
.
.
.
-------------------

Anyone know why this is happening? Is this a known bug or should I try to submit a bug report? Or is this plain user error?

I know 2.7.x has been out for a while now and I've run into the problem back when it was released but never found time to actually report this, used the 2.6.0 version and kind of forgot about this. Now I remembered it and wanted to report it anyway :)
Our documentation in php can be found at http://exult.sourceforge.net/docs.php, our svn is at 

svn co https://exult.svn.sourceforge.net/svnroot/exult exult

At http://exult.svn.sourceforge.net/viewvc/exult/exult/trunk/docs/xml/ you can browse the xml/xsl stuff, a sourcecode snapshot can be downloaded at http://www.math.leidenuniv.nl/~wpalenst/cvs/exult-svn.tar.gz
I used to do this on Windows and am pretty sure I ran into the same problem back then, now I'm on OS X and my java has the version 

java -showversion
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode)

Do you need any other information?


Thanks and take care

Dominik

Re: xsl:number value problem with Xalan-j since 2.7.0

Posted by Dominik Reichardt <do...@gmail.com>.
Grrr, I just realized I've sent this only to Michael Ludwig and not the ML. A mistake I'm always making when new to a list. Sorry all, my reply is after the quotes.

> Dominik Reichardt schrieb am 16.08.2010 um 04:23 (+0200):
> 
>> On top of our documentation we provide a changelog with which we begin
>> numbering our chapters/sections but since it is only the changes we
>> start at 0 by doing:
>> 
>> <xsl:template name="TOC">
>> 	<xsl:for-each select="section">
>> 		<xsl:number level="multiple"
>> 					count="section"
>> 					format="1. "
>> 					value="position() -1"/>
>> 		<xsl:value-of select="@title"/><xsl:text>&#xA;</xsl:text>
> 
> Not sure how you're generating your TOc. Couldn't you just use something
> like:
> 
> 
> 
> 1.
> 1.1.
> 1.2.
> 2.
> 2.1.
> 2.1.1.
> 2.1.2.
> 2.2.
> 

What I'm aiming to get and what I get with xalan-j 2.6.0 is 

0.
0.1.
0.2.
1.
1.1.
1.2.

With the exact same files I get with xalan-j 2.7.x

0
01
02
1.
1.1.
1.2.

notice the missing dots

>> Anyone know why this is happening? Is this a known bug or should I try
>> to submit a bug report? Or is this plain user error?
> 
> For me, that's difficult to say without knowing what you're actually
> doing.
> 

I'm using the xml file 
http://exult.svn.sourceforge.net/viewvc/exult/exult/trunk/docs/xml/docs.xml?revision=6322
and the dtd file
http://exult.svn.sourceforge.net/viewvc/exult/exult/trunk/docs/xml/docs.dtd?revision=4839
with the xsl file
http://exult.svn.sourceforge.net/viewvc/exult/exult/trunk/docs/xml/text.xsl?revision=4838
to produce a text file (or with other xsl files to produce php and html files) with this makefile
http://exult.svn.sourceforge.net/viewvc/exult/exult/trunk/docs/xml/Makefile?revision=6206


>> At http://exult.svn.sourceforge.net/viewvc/exult/exult/trunk/docs/xml/
>> you can browse the xml/xsl stuff, a sourcecode snapshot […]
> 
> I have no idea if this is a bug or a bugfix. It would be easier if you
> supplied a minimal, self-contained example (like above) that exposes the
> behaviour - correct or incorrect - that you're seeing.
> 

Unfortunately I'm mostly using this and not making it, when I spent some hours to wrap my head around it I kind of understand what I'm doing and can do little fixes but the whole template thing has not been started by me. The whole thing is over eight years old and might be a bit backwards at times or not as simple as it could be.

--
Take care
Dominik Reichardt

Re: xsl:number value problem with Xalan-j since 2.7.0

Posted by Michael Ludwig <mi...@gmx.de>.
Dominik Reichardt schrieb am 16.08.2010 um 04:23 (+0200):

> On top of our documentation we provide a changelog with which we begin
> numbering our chapters/sections but since it is only the changes we
> start at 0 by doing:
> 
> <xsl:template name="TOC">
> 	<xsl:for-each select="section">
> 		<xsl:number level="multiple"
> 					count="section"
> 					format="1. "
> 					value="position() -1"/>
> 		<xsl:value-of select="@title"/><xsl:text>&#xA;</xsl:text>

Not sure how you're generating your TOc. Couldn't you just use something
like:

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="text"/>

  <xsl:template match="/">
    <xsl:apply-templates mode="toc"/>
  </xsl:template>

  <xsl:template match="section" mode="toc">
    <xsl:number level="multiple" count="section" format="1."/>
    <xsl:text>&#10;</xsl:text>
    <xsl:apply-templates mode="toc"/>
  </xsl:template>

  <xsl:template match="text()" mode="toc"/>
</xsl:stylesheet>

**** And: ****

<doc>
  <section>
    <section/>
    <section/>
  </section>
  <section>
    <section>
      <section/>
      <section/>
    </section>
    <section>
      <section/>
      <section/>
      <section>
        <section/>
        <section/>
        <section/>
      </section>
      <section/>
    </section>
    <section>
      <section/>
      <section/>
    </section>
  </section>
  <section>
    <section/>
    <section/>
    <section/>
  </section>
</doc>

**** To get: ****

1.
1.1.
1.2.
2.
2.1.
2.1.1.
2.1.2.
2.2.
2.2.1.
2.2.2.
2.2.3.
2.2.3.1.
2.2.3.2.
2.2.3.3.
2.2.4.
2.3.
2.3.1.
2.3.2.
3.
3.1.
3.2.
3.3.

> Anyone know why this is happening? Is this a known bug or should I try
> to submit a bug report? Or is this plain user error?

For me, that's difficult to say without knowing what you're actually
doing.

> At http://exult.svn.sourceforge.net/viewvc/exult/exult/trunk/docs/xml/
> you can browse the xml/xsl stuff, a sourcecode snapshot […]

I have no idea if this is a bug or a bugfix. It would be easier if you
supplied a minimal, self-contained example (like above) that exposes the
behaviour - correct or incorrect - that you're seeing.

-- 
Michael Ludwig