Re: xsl:number value problem with Xalan-j since 2.7.0
Michael Ludwig <[email protected]> Mon, 16 Aug 2010 22:23:08 +0200
| Newsgroups | gmane.text.xml.xalan.java.user |
|---|---|
| Message-ID | <20100816202308.GN852@wladimir> |
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>
</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> </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