Subject: Re: [xsl] different results with xalan and msxsl/saxon From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 18 Feb 2002 11:36:17 +0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] different results with xalan , Frank | Thread | [xsl] <br> in with-param, Ilyasov Jienbay |
[xsl] <br> in with-param, Ilyasov Jienbay | Date | [xsl] alternate row color in a tabl, Sébastien Tisserant |
Month |