Sort Tool |
The Sort Tool is used to automatically organize data in the form of nodes, or blocks of XML data that may also contain references to other blocks of data. One example would be using the Sort Tool to organize a digitized library. The Sort Tool could be used to automatically sort the individual pages into books, and to organize those books into a classification system or tree that would make it easier to find the individual page or book.
The Sort Tool requires a fully-functional Streaming Editor with which all XML transformations can be carried out, such as the XSLT based streaming editor. If the units to be sorted (sort units) and the sort key have not yet been marked up consistently (i.e., identifiable by XPath expressions), you will need to supply suitable markup before using the Sort Tool and, optionally, remove that markup after the sorting process.
The Sort Tool requires five parameters:
- xmltree: The XML document to sort. This document must be well-formed, but it will not be validated by the tool
- unitXPath: An XPath expression (encoded as an xs:string) that selects the sort units. The path expression will be evaluated relatively to the root of xmltree and should return a node set of elements that will be sorted
- keyXPath: An XPath expression (encoded as an xs:string) that selects the sort key within the sort unit. The expression will be evaluated relatively to each sort unit selected by the unitXPath and must return a string
- nsmap: A map of XML prefixes to namespaces. Prefixes used in unitXPath or keyXPath must be declared here
- collator: A description of the collation sequence to be used
Further information is available here:
R2.3: User's Manual TextGrid-Tools (on page 70)