Name
p:text-sort — The standard p:text-sort step.
Synopsis
The p:text-sort step sorts lines in a text document.
| Input port | Primary | Sequence | Content types |
|---|---|---|---|
| source | ✔ | text |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | text |
| Option name | Type | Values | Default value |
|---|---|---|---|
| case-order | xs:string? | ('upper-first', 'lower-first') | () |
| collation | xs:string? | () | |
| lang | xs:language? | () | |
| order | xs:string | ('ascending', 'descending') | 'ascending' |
| sort-key | XPathExpression | '.' | |
| stable | xs:boolean | true() |
Declaration
1 |<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" type="p:text-sort">
| <p:input port="source"
| primary="true"
| sequence="false"
5 | content-types="text"/>
| <p:output port="result"
| primary="true"
| sequence="false"
| content-types="text"/>
10 | <p:option xmlns:e="http://www.w3.org/1999/XSL/Spec/ElementSyntax"
| name="sort-key"
| as="xs:string"
| select="'.'"
| e:type="XPathExpression"/>
15 | <p:option name="order"
| as="xs:string"
| select="'ascending'"
| values="('ascending', 'descending')"/>
| <p:option name="case-order"
20 | as="xs:string?"
| values="('upper-first', 'lower-first')"/>
| <p:option name="lang" as="xs:language?"/>
| <p:option name="collation" as="xs:string?"/>
| <p:option name="stable" as="xs:boolean" select="true()"/>
25 |</p:declare-step>Errors
| Code | Description |
|---|---|
err:XC0098 | It is a
dynamic error (err:XC0098) if a dynamic XPath error occurred while applying sort-key to a line. |
err:XC0099 | It is a dynamic error (err:XC0099) if the result of applying sort-key
to a given line results in a sequence with more than one item. |
Implementation defined features
- Support for other collations is implementation-defined.
Description
The p:text-sort step is a
standard XProc 3.0 step.
It is also described on XProcRef.org.
Additional examples
The XProc test suite contains examples of the p:text-sort step.