[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Grouping and numbering in XSLT 2.0,

Subject: Re: Grouping and numbering in XSLT 2.0,
From: andrew welch <andrew.j.welch@xxxxxxxxx>
Date: Tue, 15 Nov 2005 14:14:29 +0000
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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.