|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Grouping and numbering in XSLT 2.0,
> 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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








