Subject: Re: [xsl] Grouping and numbering in XSLT 2.0, From: andrew welch <andrew.j.welch@xxxxxxxxx> Date: Tue, 15 Nov 2005 14:14:29 +0000 |
> Hi, > > Thanks for your reply, that solution worked well. > > However I have encountered a problem when i tried to apply the > solution to more than one "<vendors>". The iteration becoms wrong. I > have added an XML and > an XSLT that shows the problem. > > I would be very pleased if some of you could take a look at it and > propose a solution. You just need to adjust your paths from absolute to relative: <?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" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <vendors> <xsl:apply-templates/> </vendors> </xsl:template> <xsl:template match="component"> <component> <xsl:apply-templates select="cell[@name ='Company']/value"/> </component> </xsl:template> <xsl:template match="cell[@name = 'Company']/value"> <vendor> <cell name="Company"> <xsl:copy-of select="."/> </cell> <xsl:variable name="pos" select="position()"/> <xsl:apply-templates select="../../cell[@name ='Cage']/value1[$pos]"/> <xsl:apply-templates select="../../cell[@name ='Address']/value2[$pos]"/> </vendor> </xsl:template> <xsl:template match="cell[@name = 'Cage']/value1"> <cell name="Cage"> <xsl:copy-of select="."/> </cell> </xsl:template> <xsl:template match="cell[@name = 'Address']/value2"> <cell name="Address"> <xsl:copy-of select="."/> </cell> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Grouping and numbering in, geirr.prestholdt | Thread | RE: [xsl] Text to come after a bloc, Haarman, Michael |
RE: [xsl] Grouping and numbering in, geirr.prestholdt | Date | Re: [xsl] Display file name, Manfred Staudinger |
Month |