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

Re: different results with xalan and msxsl/saxon

Subject: Re: different results with xalan and msxsl/saxon
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 18 Feb 2002 11:36:17 +0000
Re:  different results with xalan and msxsl/saxon
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


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.