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

Re: from random tags to an ordered tags

Subject: Re: from random tags to an ordered tags
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Thu, 11 Oct 2001 21:32:07 +0200
xsl sort random
I don't know if I understood you correctly, but this is my solution:

<xsl:template match="root_elem">
    <xsl:apply-templates select="*">
        <xsl:sort select="@seq"/>
    </xsl:apply-templates>
</xsl:template>

<xsl:template match="*">
    <!-- do what you want with <tag_x> -->
</xsl:template>

Look in the spec or in references like on zvon.org or topxml.com for more
options of <xsl:sort> (e.g. sort-order). You can add more <xsl:sort> above,
the applied elements will be sorted at first for the given in 'select=".." '
of the first <xsl:sort>, then the second <xsl:sort> and so on.

Joerg


----- Original Message -----
From: "yan bai" <bytj@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, October 11, 2001 8:44 PM
Subject:  from random tags to an ordered tags


> Hi, Gurus,
>
> I have a source file in .xml type.  Except the root
> element <root_elem>......</root_elem>, all elements
> come in a time sequence from a server.  For instance,
> <root_elem>
> <tag_0 id="b12313" seq="1" content="Here is the
> summary the the book"/>
> <tag_5 id="i234234" seq="2" information="here is some
> info"/>
> <tag_2 id="b12334" seq="3" name="The book title here:
> A"/>
> <tag_8 id="b12337" seq="4" name="Here is a
> publisher"/>
> <tag_4 id="b34533" seq="5" name="here is the date"/>
>
> .
> .
> .
> </root_elem>
>
> Please note <tag_0>, <tag_1>, ..., <tag_x> comes in a
> random sequence.  Any tag may come before another in
> this source .xml file.  the attribute "seq" indicates
> in the order of tags.
>
> I need to use xslt to transform these tags into a
> well-formed xml file according to the sequence
> attribute "seq".  Whatever tag comes the first, it
> needs to be the first tag in the destination xml file.
>
> Anyone knows how?
>
> Thanks a ton in advance.


 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.