Re: [xsl] Is this about grouping ?

Subject: Re: [xsl] Is this about grouping ?
From: tcn@xxxxxxxxxxxxx (Trevor Nash)
Date: Sat, 30 Jun 2001 10:03:08 GMT
Hi Benoit

Yes, I think a grouping method such as Meunchian should get rid of the
duplicates for you.  Read up on it anyway, it is something you will
either use or see sooner or later.  Its not clear from your example
whether you need to sort or what the xsl:key should be:  If you had
<element3>text1</element3> at the end of your input, would this appear
in the output and if so, where?  i.e. are you sorting by text, and is
uniqueness determined by the text alone or is the element name

As to the indentation, there is no magic way of doing this.  If you
really need to do it, then you have to put the required space where it
is wanted by means of xsl:text.  As a seperate stylesheet this is
fairly simple - look up xsl:copy and xsl:strip-space - but mixed in
with the grouping logic it could be a nightmare.  Unless you have a
tight performance target I would keep it separate.

Original message:
>Hi all,
>Here is my problem ( newbies question ).
>My original source is like this :
><?xml version="1.0"?>
>    <element1>text1</element1>
>    <element2>text2</element2>
>    <element3>text3</element3>
>    <element4>text4</element4>
>    <element1>text1</element1>
>    <element2>text2</element2>
>    <element3>text5</element3>
>    <element4>text6</element4>
>I would like to transform it into :
><?xml version="1.0"?>
>    <element1>text1</element1>
>    <element2>text2</element2>
>        <element3>text3</element3>
>        <element4>text4</element4>
>        <element3>text5</element3>
>        <element4>text6</element4>
>As you see, the common element are <element1> and <element2>.
>My questions are :
>1. as I'm really new to XSLT, is this related to multi-pass issue or
>grouping issue
>   ( Muenchian, Kaysian, etc ) ?
>2. how can I generate a correct indentation in the result tree ( XML output
>) as above ?
>   I mean how is it possible for me to generate, say, for that element the
>indentation is
>   4 chars ( 1 tab ), but for that element is 8 chars ( 2 tabs ) ?
>If you find my questions are too basics, rather than suggest me to read the
>on-line tutorials,
>buy those XSLT books, etc, please ignore my questions.
>If you think that we can advice, guide, and learn each others, I appreciate
>Benoit Aumars.

Best Regards,
Trevor Nash
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:

Current Thread