Project

Profile

Help

Non conformance with XSLT keys

Added by Anonymous over 15 years ago

Legacy ID: #7376167 Legacy Poster: Sebastian Unger (sebunger)

Hi, I have tried to track down a very weird behaviour in one of our XSLTs and tracked it down to something, I believe is a non-conformance of saxon B-9.1.0.6 (also present in 9.1.0.5): Consider the following XSLT stylesheet: <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tt="http://www.powerware.com/nz/tt"> <xsl:key name="tt:testKey" match="node()" use="('a', 'b')"/> <xsl:key name="tt:testKey" match="node()" use="('a', 'b')"/> <xsl:template match="/"> <xsl:message select="count(key('tt:testKey', 'b'))"/> <xsl:message select="count(key('tt:testKey', 'b'))"/> </xsl:template> </xsl:stylesheet> When run against any input document, I would expect it to print the count of nodes in that document twice. However, it prints the count correctly once and then prints zero for the second message. Has anybody seen this before and even more importantly does anybody have a work-around until this can be fixed? Cheers, Seb


Replies (4)

Please register to reply

RE: Non conformance with XSLT keys - Added by Anonymous over 15 years ago

Legacy ID: #7376178 Legacy Poster: Michael Kay (mhkay)

Thanks for getting it down to a simple test case. Looks like a bug that's been there more-or-less for ever: if a named key has more than one xsl:key declaration and a (node, value) pair selected by the second key declaration is the same as a (node, value) pair selected by the first key declaration, then no further values selected by the use expression in the second key declaration for that node are included in the index. It should be an easy fix, which I will do in the morning.

RE: Non conformance with XSLT keys - Added by Anonymous over 15 years ago

Legacy ID: #7376180 Legacy Poster: Michael Kay (mhkay)

For a workaround, if you can, try merging the key declarations into one.

RE: Non conformance with XSLT keys - Added by Anonymous over 15 years ago

Legacy ID: #7376187 Legacy Poster: Sebastian Unger (sebunger)

Thanks for that quick reply! I'll try the merge.

RE: Non conformance with XSLT keys - Added by Anonymous over 15 years ago

Legacy ID: #7376855 Legacy Poster: Michael Kay (mhkay)

The bug is now logged here: https://sourceforge.net/tracker/?func=detail&amp;aid=2787726&amp;group_id=29872&amp;atid=397617 and a fix is in Subversion.

    (1-4/4)

    Please register to reply