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

Re: XSL Processing to avoid repetitions

Subject: Re: XSL Processing to avoid repetitions
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 16 Jun 2010 15:40:28 +0100
Re:  XSL Processing to avoid repetitions
On 16/06/2010 15:28, Fabien Tillier wrote:

please don't take things off list,


On 16/06/2010 15:28, Fabien Tillier wrote: <xsl:for-each-group select="/Results/Row" group-by="CODE">

not <xsl:for-each-group select="/Results/Row/CONTRACT" group-by="CODE">


or perhaps more naturally since you are already on /results


<xsl:for-each-group select="Row" group-by="CODE">

David





I did use xslt 2 (was in my first mail).
The fact is that when I use the xslt I have modified, I get nothing...
(well, only one<ol></ol>)
So, I suppose I have made something wrong....

Here is my xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method = "html" encoding="ISO-8859-1"/>
<xsl:template match="Results">
	<ol>
	<xsl:for-each-group select="/Results/Row/CONTRACT" group-by="CODE">
   		<li>
   			<xsl:value-of select="current-grouping-key()"/>
   			<ol>
   				<xsl:for-each select="current-group()/CODE">
   				<li>
   					<xsl:value-of select="."/>
   				</li>
   				</xsl:for-each>
   			</ol>
   		</li>	
   	</xsl:for-each-group>	
   	</ol>
</xsl:template>
</xsl:stylesheet>

And the XML file
<?xml version="1.0" encoding="UTF-8"?>
<Results>
   <Row>
     <CONTRACT>1000</CONTRACT>
     <CODE>1000-1</CODE>
     <NUMERO>110</NUMERO>
     <STATE>0</STATE>
   </Row>
   <Row>
     <CONTRACT>1000</CONTRACT>
     <CODE>1000-1</CODE>
     <NUMERO>567</NUMERO>
     <STATE>0</STATE>
   </Row>
   <Row>
     <CONTRACT>1000</CONTRACT>
     <CODE>1000-1</CODE>
     <NUMERO>936</NUMERO>
     <STATE>0</STATE>
   </Row>
   <Row>
     <CONTRACT>1000</CONTRACT>
     <CODE>1000-2</CODE>
     <NUMERO>110</NUMERO>
     <STATE>0</STATE>
   </Row>
   <Row>
     <CONTRACT>1000</CONTRACT>
     <CODE>1000-2</CODE>
     <NUMERO>567</NUMERO>
     <STATE>0</STATE>
   </Row>
   <Row>
     <CONTRACT>1000</CONTRACT>
     <CODE>1000-2</CODE>
     <NUMERO>936</NUMERO>
     <STATE>0</STATE>
   </Row>
</Results>

Many thanks...

Fabien


-----Message d'origine----- De : David Carlisle [mailto:davidc@xxxxxxxxx] Envoyi : mercredi 16 juin 2010 16:18 @ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx Cc : Fabien Tillier Objet : Re: XSL Processing to avoid repetitions

On 16/06/2010 15:10, Fabien Tillier wrote:
Hi Martin.
Thanks for your answer, but it doesn't work for me.

please say what goes wrong when things go wrong. eg wrong output, or error message, or machine melts down?

one thing is all the answers have been xslt 2 but I don't think you said
if you were using xslt 1 or 2.

David



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________

________________________________________________________________________
This e-mail has been scanned for all viruses by Star.
________________________________________________________________________



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________


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.