Re: sorting, was: Version 3.0 now available!
Brought to you by:
bs_php,
nigelswinson
From: Nigel S. <nig...@us...> - 2002-05-13 18:07:48
|
> > How do you sort that, other than in document order? > > And if you add a further nnn <p> nodes - the norm in document files - how > can > > they be used if not in document order? In what order can the 'nodes' of, > say, > > a Shakespeare play be processed other than the one he wrote?! > >.. > > Yes. And also I could imagine a dozen other cases, except my current one > where I'd need it. > Imagine you want to build a table-of-contents for an XHTML page. > The most reasonable expression to me seems to be: > //h1 | //h2 | //h3 | //h4 | //h5 | //h6 > and then process this e.g. building a nested list. > It's very important here that an h2 following an h1 in the original document > can be understood as belonging to this h1 as a sub-heading. > (I do the above in an MSXML4-based Content Management System.) Ok I totally agree that doc order is the most useful, but how about this scenario: <?xml version="1.0" ?> <XmlDatabase> <Sermons> <Sermon RecordId="1"> <Date>1-Jan-92</Date> <CatalogueNo>BRJ 01</CatalogueNo> <Speaker>Brian Russell-Jones</Speaker> </Sermon> <Sermon RecordId="3"> <Date>1-Jan-92</Date> <CatalogueNo>WS 01</CatalogueNo> <Speaker>Wayne Sutton</Speaker> </Sermon> <Sermon RecordId="4"> <Date>1-Mar-92</Date> <CatalogueNo>BRJ 04</CatalogueNo> <Speaker>Brian Russell-Jones</Speaker> </Sermon> <Sermon RecordId="5"> <Date>1-Apr-92</Date> <CatalogueNo>WS 02</CatalogueNo> <Speaker>Wayne Sutton</Speaker> </Sermon> </Sermons> </XmlDatabase> You want to search for all the sermons, but have them sorted by date, catalogue, or speaker. If sorted by date you get: /XmlDatabase[1]/Sermon[1] /XmlDatabase[1]/Sermon[2] /XmlDatabase[1]/Sermon[3] /XmlDatabase[1]/Sermon[4] If sorted by speaker you get: /XmlDatabase[1]/Sermon[1] /XmlDatabase[1]/Sermon[3] /XmlDatabase[1]/Sermon[2] /XmlDatabase[1]/Sermon[4] etc. What I'll try to do is to make doc order the default output, but there may still be occasions where sorting the data by some other criteria is useful. Nigel |