Subject: [xsl] MSXML4, key() across node-set From: "Alex Schuetz" <asc@xxxxxx> Date: Thu, 20 Dec 2001 21:16:53 +0100 |
As far as I can tell, when using a key() with the MSXML4 extention node-set(), the call to key('key-name', val)[1] does not always return the same node for a constant val. I have this stylesheet: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:variable name="set" select="msxsl:node-set(document(/files/node/@path))"/> <xsl:key name="k-id" match="person" use="@id" /> <xsl:template name="distinct"> <xsl:for-each select="$set/doc/person[@id='4']"> <info self-id="{generate-id(.)}" index-id="{generate-id(key('k-id',@id)[1])}"> <self> <xsl:copy-of select="."/> </self> <index> <xsl:copy-of select="key('k-id',@id)[1]" /> </index> </info> </xsl:for-each> </xsl:template> <xsl:template match="/"> <test> <xsl:call-template name="distinct" /> </test> </xsl:template> </xsl:stylesheet> And two input files: ------------------------------------------- input1.xml <?xml version="1.0" encoding="utf-8" ?> <doc> <person name="onePerson" id="4" /> </doc> ------------------------------------------- input2.xml <?xml version="1.0" encoding="utf-8" ?> <doc> <person name="otherPerson" id="4" /> </doc> ----------------------------------------------- When I run my stilesheet I get: <?xml version="1.0" encoding="UTF-16" ?> - <test xmlns:msxsl="urn:schemas-microsoft-com:xslt"> - <info self-id="IDAUQ2N" index-id="IDAUQ2N"> - <self> <person name="onePerson" id="4" /> </self> - <index> <person name="onePerson" id="4" /> </index> </info> - <info self-id="IDAIY2N" index-id="IDAIY2N"> - <self> <person name="otherPerson" id="4" /> </self> - <index> <person name="otherPerson" id="4" /> </index> </info> </test> It looks like there is a seperate key for each tree-fragment in the node-set. Did I miss something, or is this a known problem? -alex XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Filling a table cell with, Joerg Heinicke | Thread | Re: [xsl] MSXML4, key() across node, Joerg Heinicke |
[xsl] Filling a table cell with a d, Matthew L. Avizinis | Date | Re: [xsl] Text flowing around image, David Tolpin |
Month |