[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|