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="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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: XPath help, edmund mitchell | Thread | Re: XPath help, edmund mitchell |
RE: question with using Muenchian/x, Xiaocun Xu | Date | A new twist on attributes vs elemen, Melvyn Rosengarden |
Month |