[XML-SIG] 4xslt bug involving key()

Mike Olson Mike.Olson@fourthought.com
Sat, 30 Jun 2001 08:49:46 -0600


"Thomas B. Passin" wrote:


Thomas,

  I forget if someone replied to you, but this appears to be fixed in
CVS.  

Mike  
> 
> 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
> 
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://mail.python.org/mailman/listinfo/xml-sig

-- 
Mike Olson                                Principal Consultant
mike.olson@fourthought.com                +1 303 583 9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
XML strategy, XML tools (http://4Suite.org), knowledge management