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

Re: Is this about grouping ?

Subject: Re: Is this about grouping ?
From: tcn@xxxxxxxxxxxxx (Trevor Nash)
Date: Sat, 30 Jun 2001 10:03:08 GMT
Re:  Is this about grouping ?
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
involved?

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"?>
><topic>
>    <element1>text1</element1>
>    <element2>text2</element2>
>    <element3>text3</element3>
>    <element4>text4</element4>
>
>    <element1>text1</element1>
>    <element2>text2</element2>
>    <element3>text5</element3>
>    <element4>text6</element4>
></topic>
>
>I would like to transform it into :
>
><?xml version="1.0"?>
><topic>
>    <element1>text1</element1>
>    <element2>text2</element2>
>        <element3>text3</element3>
>        <element4>text4</element4>
>        <element3>text5</element3>
>        <element4>text6</element4>
></topic>
>
>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
>that.
>
>Thanks,
>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:  http://www.mulberrytech.com/xsl/xsl-list


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.