Subject: RE: Re: [xsl] Recursive calls to a named template From: cknell@xxxxxxxxxx Date: Thu, 20 Nov 2003 14:13:52 -0500 |
> -----Original Message----- > From: Kevin Jones <kjones@xxxxxxxxxxx> > Subject: Re: [xsl] Recursive calls to a named template I tried your solution, which sounds like a better tack than the one I proposed, but no <signature> elements were copied from related <group> elements. Here is the stylesheet: ================= <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:key name="GroupByIdentifier" match="group" use="identifier[1]"/> <xsl:template match="signature"> <xsl:choose> <xsl:when test="count(../identifier[2])>0"> <xsl:apply-templates select="key('GroupByIdentifier',../identifier[2])/signature"/> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> </xsl:stylesheet> and here is the output: ================= <?xml version = '1.0' encoding = 'UTF-8'?> <formatted-xml> <group> <identifier>a</identifier> <signature>signature <identifier>DNSQuery1</identifier> <in>in <long>long</long> <identifier>ant</identifier> </in> </signature> </group> <group> <identifier>b</identifier> <identifier>a</identifier> <signature>signature <identifier>DNSQuery1</identifier> <in>in <long>long</long> <identifier>ant</identifier> </in> </signature> </group> <group> <identifier>c</identifier> <identifier>b</identifier> <signature>signature <identifier>DNSQuery1</identifier> <in>in <long>long</long> <identifier>ant</identifier> </in> </signature> </group> </formatted-xml> What did I miss in your explanation? -- Charles Knell cknell@xxxxxxxxxx - email XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Recursive calls to a name, Kevin Jones | Thread | Re: Re: [xsl] Recursive calls to a , Kevin Jones |
Re: [xsl] JavaScript and XSLT, Rick Taylor | Date | [xsl] XSL Transformation in secure , Sridhar Sourirajan |
Month |