Altova Mailing List Archives


RE: [xsl] XSL Processing to avoid repetitions

From: "Fabien Tillier" <f.tillier@-----.-->
To: <xsl-list@-----.------------.--->
Date: 6/16/2010 1:37:00 PM
Andrew, You are probably right, I came to nowhere....
Thanks also to David for is nearly as fast answer :)

So, I have these data

<?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>
  <Row>
</Results>

And I would like to reshape the data to get something clean (from CONTRACT, CODE and NUMERO)
1000
	1000-1
		110
		567
		936
	1000-2
		110
		567
		936
1001
	1001-1
		150
^1001 contract is not shown here but can in the rest of the XML...

Thanks a lot in advance
PS: Fields are supposed to be ordered already....

-----Message d'origine-----
De : Andrew Welch [mailto:andrew.j.welch@g...] 
Envoyé : mercredi 16 juin 2010 15:23
À : xsl-list@l...
Objet : Re: [xsl] XSL Processing to avoid repetitions

On 16 June 2010 14:15, Fabien Tillier <f.tillier@c...> wrote:
> Hi List.
> I was wondering if anyone could help me to filter out data in an XML stream.
> (can be xslt 2.0...)
>
> For example, I have
> <xml>
>       <city>
>             <name>Paris</name>
>             <person>Paul</person>
>       </city>
>       <city>
>             <name>New-York</name>
>             <person>John</person>
>       </city>
>       <city>
>             <name>Paris</name>
>             <person>George</person>
>       </city>
> </xml>
>
> I would like to have an XSL template able to output something like (using <OL> for example) Paris
>       Paul
>       George
> New-York
>       John

Use xsl:for-each-group to select <city> and group by <name>, and
within that use current-grouping-key() to get place and then for-each
over the current-group() to get each name.

> (please note that the real structure is more complicated, and the filter is to be done on more than one level...)

...in which case its probably best to post a complete sample.


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@l...>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@l...>
--~--

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.