[XML-SIG] 4xslt bug involving key()
Thomas B. Passin
tpassin@home.com
Sun, 10 Jun 2001 22:19:42 -0400
I've just found that a stylesheet construction that I need to use doesn't
work right with 4xslt (the python 1.5.2 version I got from the 4suite.org
site several weeks ago).
The stylesheet takes a number of elements that have duplicated content and
produce a list without duplicates. It's a simplified Muenchian method,
using <xsl:key/> and key(). It works right with msxml3, saxon, and xalan,
but not 4xslt. I need to use this in a project I'm in the middle of at
work, so I request the 4thought people (Mike, would that be?) to take a look
at it.
If 4xslt doesn't implement keys (I thought it did), then at least it should
throw an error.
Here are the documents and the results:
<items>
<a>A</a>
<a>B</a>
<a>C</a>
<a>B</a>
<a>B</a>
<a>D</a>
<a>D</a>
<a>E</a>
</items>
===============================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='text'/>
<xsl:key name='item' match='a' use='.'/>
<!--////// Create a node-set of unique items /////-->
<xsl:variable name='unique-items'
select="/items/a
[generate-id()=generate-id(key('item',.)[1])]"/>
<!--////// Test if we really got a unique list /////-->
<xsl:template match="/">
Original list:
<xsl:copy-of select='items/a'/>
Should-be-unique list:
<xsl:copy-of select='$unique-items'/>
</xsl:template>
</xsl:stylesheet>
===========================================================
Results from saxon:
D:>saxon unique2.xml unique2.xsl
Original list:
ABCBBDDE
Should-be-unique list:
ABCDE
Results from 4xslt (running from a batch file driver):
D:>4xslt unique2.xml unique2.xsl
Original list:
ABCBBDDE
Should-be-unique list:
ABCBBDDE
See the problem?
Regards,
Tom P