Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Xml sorting - URGENT

From: slinky <campbellbrian2001@-----.--->
To: NULL
Date: 7/10/2007 5:43:00 AM

I have a website about historical events and my data will be coming in
in well-formed XML format like below

<?xml version="1.0" standalone="yes"?>
<events>
     <topic>
         <event>Vienna Summit with Soviet Premier Nikita Kruschev</
event>
         <year>1961</year>
     </topic>
     <topic>
         <event>Born: May 29, 1917 in Brookline, Massachusetts </
event>
         <year>1917</year>
     </topic>
     <topic>
         <event>In 1953, Kennedy married Jacqueline Lee Bouvier </
event>
         <year>1953</year>
     </topic>
  year>
     </topic>
</events>

I have successfully read the data into a datagrid, but I need to sort
the events by year. I'd like to do that not at the .aspx level of my
web-form but prior to reading it into that.

I'm very new to the concept of sorting XML but I found some snippets
that may help if anyone could give me some basic clues:

I'm assuming I need to publish an XSL file separate (?) from the
actual XML file (?):

something like:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="events">
    <html>
    <body>
    <!--
  <ul>
    <xsl:apply-templates select="event">
      <xsl:sort select="year"/>
    </xsl:apply-templates>
  </ul>
</xsl:template>
    -->
    </body>
    </html>
</xsl:template>
</xsl:stylesheet>

There are probably syntax or logioc errors above from this I get and
modified from MSDN, but I thought it would be a start. Also how can I
associate the XML file with the XSL to do the SORT?

THANKS!!!!!!



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent