xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] XSL Processing to avoid repetitions


Subject: Re: [xsl] XSL Processing to avoid repetitions
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 16 Jun 2010 15:40:28 +0100

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] 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
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor