Re: XPath help

Subject: Re: XPath help
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Sun, 12 Nov 2000 22:49:06 +0000

edmund mitchell wrote:
> <weird_doc>
>    <System name="ABC">...</System>
>    <System name="Whatever">...</System>
>    <System name="mail">
>       <Function name="Routing DB">...</Function>
>       <Function name="client">...</Function>
>    </System>
>    <System name="mail">
>       <Function name="pop3">...</Function>
>       <Function name="smtp">...</Function>
>    </System>
>    <System name="news">...</System>
>    <System name="account">...</System>
>    <System name="Authentication">...</System>
> </weird_doc>

This seems to work - it depends on the fact that the key() function
returns a node-set while generate-id() only operates on the first node
(in document order) from the node-list argument.

<xsl:stylesheet xmlns:xsl="";
	<xsl:key name="systems" match="System" use="@name"/>
	<xsl:template match="/">
			<xsl:for-each select="//System[generate-id(.) =
generate-id(key('systems', @name))]">
					<xsl:copy-of select="@name"/>
					<xsl:copy-of select="key('systems', @name)/*"/>

Francis Norton.

why not?

 XSL-List info and archive:

Current Thread