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

RE: in place ordering of XML


ordering in xml

Your specification of the problem is very incomplete, but my design
approach would be to generate from the schema an XSLT stylesheet of the
form:

<xsl:variable name="element-list"
select="'foo bar pooh ... '"/>

<xsl:template match="...">
  <xsl:for-each select="*">
  <xsl:sort select="string-length(substring-before($element-list,
                         concat(name(), ' ')"
            data-type="number"/>
    <xsl:copy-of select="."/>
  </xsl:for-each>
</xsl:template>

Michael Kay

> 
> My Application is  recieving a sequence of XML Nodes. I need 
> to create a 
> XML Doc from these ,having all these nodes in order as 
> dictated by the 
> schema , "in the most efficient of ways"..
> For e.g. if the schema is saying
> 
> <xsd:element name = "foo">
> <xsd:element name = "bar">
> <xsd:element name = "pooh">
> 
> If I get the xml nodes in the order "bar", "pooh" and "fooh", 
> the tree 
> should be built with these in order as in the schema.
> 
> i.e.
> <target>
> <foo>
> <bar>
> <pooh>
> </target>
> 
> Any help wuld be appreciated.
> 
> rgds,
> Menon
> 
> 
> 
> -- 
> Ramkumar Menon,
> Oracle India Pvt Ltd,
> Bangalore - 82
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org 
> <http://www.xml.org>, an initiative of OASIS 
<http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.