XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Vincent NgSubject: Grouping in XSLT 1.0
Author: Vincent Ng
Date: 09 Jan 2007 12:25 PM
Originally Posted: 09 Jan 2007 12:23 PM
Hi,

I would like to implement following XSLT 2.0 XSL using XSLT 1.0.
Does anyone know the equivalent code using XSLT 1.0? I have attached the source XML (cIMSDirect.xml) and target XML (cIMSHeaderline.xml). Basically, I need to transform the source structure by grouping similiar values in <VendorNo>,ChargeToCode>,<ShipToCode>,<CustomerPO>,<ReqDate>,<ShipMethod>


<?xml version='1.0' ?>
<xsl:stylesheet xmlns:a="urn:test-com:IMS:IMS:V0001" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<cIMSDirectHeaderLine>
<IMSDirect>
<xsl:for-each-group select="a:cIMSDirect/IMSDirect/IMSDirect" group-by="VendorNo">
<xsl:for-each-group select="current-group()" group-by="ChargeToCode">
<xsl:for-each-group select="current-group()" group-by="ShipToCode">
<xsl:for-each-group select="current-group()" group-by="CustomerPO">
<xsl:for-each-group select="current-group()" group-by="ReqDate">
<xsl:for-each-group select="current-group()" group-by="ShipMethod">
<IMSDirect>
<IMSDirectHeader>
<VendorNo>
<xsl:value-of select="VendorNo"/>
</VendorNo>
<ChargeToCode>
<xsl:value-of select="ChargeToCode"/>
</ChargeToCode>
<ShipToCode>
<xsl:value-of select="ShipToCode"/>
</ShipToCode>
<CustomerPO>
<xsl:value-of select="CustomerPO"/>
</CustomerPO>
<ReqDate>
<xsl:value-of select="ReqDate"/>
</ReqDate>
<ShipMethod>
<xsl:value-of select="ShipMethod"/>
</ShipMethod>
</IMSDirectHeader>
<xsl:for-each select="current-group()">
<IMSDirectLine>
<PartNo>
<xsl:value-of select="PartNo"/>
</PartNo>
<Qty>
<xsl:value-of select="Qty"/>
</Qty>
<PriorityCode>
<xsl:value-of select="PriorityCode"/>
</PriorityCode>
<ControlNo>
<xsl:value-of select="ControlNo"/>
</ControlNo>
<VendorName>
<xsl:value-of select="VendorName"/>
</VendorName>
<Desrp>
<xsl:value-of select="Desrp"/>
</Desrp>
<CustomerPartNo>
<xsl:value-of select="CustomerPartNo"/>
</CustomerPartNo>
<CustomerItemNo>
<xsl:value-of select="CustomerItemNo"/>
</CustomerItemNo>
<SeqNo>
<xsl:value-of select="SeqNo"/>
</SeqNo>
<VendorBlanketPO>
<xsl:value-of select="VendorBlanketPO"/>
</VendorBlanketPO>
<SeriesCode>
<xsl:value-of select="SeriesCode"/>
</SeriesCode>
<ShipFrom>
<xsl:value-of select="ShipFrom"/>
</ShipFrom>
<Filler>
<xsl:value-of select="Filler"/>
</Filler>
</IMSDirectLine>
</xsl:for-each>
</IMSDirect>
</xsl:for-each-group>
</xsl:for-each-group>
</xsl:for-each-group>
</xsl:for-each-group>
</xsl:for-each-group>
</xsl:for-each-group>
</IMSDirect>
</cIMSDirectHeaderLine>
</xsl:template>
</xsl:stylesheet>


DocumentcIMSDirect.xml


DocumentcIMSDirectHeaderLine.xml

Postnext
Tony LavinioSubject: Grouping in XSLT 1.0
Author: Tony Lavinio
Date: 09 Jan 2007 12:43 PM
See http://www.jenitennison.com/xslt/grouping/index.xml for the
well-established standard answers for grouping under XSLT 1.0.

Posttop
Vincent NgSubject: Grouping in XSLT 1.0
Author: Vincent Ng
Date: 11 Jan 2007 12:15 PM
Thank you, Tony. I have found the solution.

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.