This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XPath help
- To: xsl-list at mulberrytech dot com
- Subject: Re: XPath help
- From: Francis Norton <francis at redrice dot com>
- Date: Sun, 12 Nov 2000 22:49:06 +0000
- References: <LAW2-F47FLsBURUOPJB000013dd@hotmail.com>
- Reply-To: xsl-list at mulberrytech dot com
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="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:key name="systems" match="System" use="@name"/>
<xsl:template match="/">
<weird_doc>
<xsl:for-each select="//System[generate-id(.) =
generate-id(key('systems', @name))]">
<System>
<xsl:copy-of select="@name"/>
<xsl:copy-of select="key('systems', @name)/*"/>
</System>
</xsl:for-each>
</weird_doc>
</xsl:template>
</xsl:stylesheet>
---
Francis.
--
Francis Norton.
why not?
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list