This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: different results with xalan and msxsl/saxon
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: "Frank" <fweenink at ambrac dot nl>
- Cc: "XSL-List" <XSL-List at lists dot mulberrytech dot com>
- Date: Mon, 18 Feb 2002 11:36:17 +0000
- Subject: Re: [xsl] different results with xalan and msxsl/saxon
- Organization: Jeni Tennison Consulting Ltd
- References: <002801c1b861$23c758d0$0d01a8c0@ambracprod.nl>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Frank,
> <!-- selecting the headings with one level higher than the preceding
> heading -->
> <xsl:key name="headings" match="file/p[starts-with(@stylename, 'heading')]"
> use="preceding-sibling::p[starts-with(@stylename, 'heading')]
> [substring(@stylename, 9 , 1)=substring(current()/@stylename, 9,
> 1)-1][1]"/>
I think that the difference between processors probably occurs here.
It may well be that when the expression held in the use attribute is
evaluated, Xalan interprets current() as referring to the matched node
(which is the correct interpretation, in my opinion) whereas MSXML and
Saxon interpret it as something else (probably the root node of the
source document).
As a work-around, if you know how many levels of headings you can
have, you could try using separate keys instead:
<xsl:key name="headings" match="file/p[@stylename = 'heading 2']"
use="preceding-sibling::p[@stylename = 'heading 1'][1]" />
<xsl:key name="headings" match="file/p[@stylename = 'heading 3']"
use="preceding-sibling::p[@stylename = 'heading 2'][1]" />
<xsl:key name="headings" match="file/p[@stylename = 'heading 4']"
use="preceding-sibling::p[@stylename = 'heading 3'][1]" />
...
Also, you should note that you're currently using the *values* of the
paragraphs as the key values, which means that you'll run into
problems if you have two headings with the same title; probably you
should generate an ID for each p element instead, and use them.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list