[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with sorting data within an xml using XSL
Peter: Step 1: can you perform any XSLT transform on an XML document? Your method call: var newXML = OriginalXML.transferNode("xslfile.XMLDocument"); is not going to work. Try this first: alert( OriginalXML.transformNode(XSLdocument) ); Once you get this to work, you can worry about step 2: can you put the result of an XSLT tranform into a new XML document, and step 3: how can I get this to sort right? -Wayne Steele >From: desimonp@i... >To: xml-dev@x... >Subject: Problem with sorting data within an xml using XSL >Date: Sun, 01 Oct 2000 18:30:27 -0400 (EDT) > > > > Say I have the following: > > <xml id="OriginalXML"> > > <root> > > <Sub_Root_Node> > > <Row field1="value1" field2="value2" /> > > <Row field1="value1" field2="value2" /> > > <Row field1="value1" field2="value2" /> > > <Row field1="value1" field2="value2" /> > > <Row field1="value1" field2="value2" /> > > <Row field1="value1" field2="value2" /> > > </Sub_Root_Node> > > </root> > > </xml> > > <xml id="xslfile" src="filexsl.xsl"></xml> > > > > I want to rebuild the XML, but have it sorted based field1, if it wasn't > > sorted at all or it was sorted on field2. What am I missing? I am >using: > > var newXML = OriginalXML.transferNode("xslfile.XMLDocument"); > > > > newXML is blank and newXML.xml is undefined... > > > > I tried the following: fileXSL.xsl > > > > <?xml version="1.0"?> > > <xsl:output method="xml"/>, > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> > > <xsl:template match="/"> > > <root> > > <Sub_Root_Node> > > <xsl:apply-templates select="Sub_Root_Node" /> > > </Sub_Root_Node> > > </root> > > </xsl:template> > > <xsl:template match="Sub_Root_Node"> > > <xsl:for-each select="Row" order-by="lmfLateDateCount"> > > <Row > > field1="<xsl:value-of select="@field1" />" > > field2="<xsl:value-of select="@field2" />" > > /> > > </xsl:for-each> > > </xsl:template> > > </xsl:stylesheet> > > > > Peter _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|