Property "Repeat | Sort <sort>"

Top  Previous  Next

"Sort" Property is used to sort the XML nodes returned by the query which is defined with

Repeat | For Each property.

The Syntax

 

expression,order,case-order,lang,data-type[;,,,,]

 

expression 

is evaluated for each node and the result is used as the sort key for that node.

order

specifies the sort order.

Options:

"a" or "ascending"
"d" or "descending"

 

case-order 

specifies uppercase or lowercase characters come first.

Options:

"u" or "upper-first"
"l" or "lower-first"

 

This applies when data-type is "text", and specifies that in ascending order upper-case letters should sort before lower-case letters or vice-versa respectively.

lang 

specifies the language of the sort keys; if no lang value is specified, the language should be determined from the system environment.

data-type 

specifies the data type of the sort keys.

Options:

"t" or "text" (the default) specifies that the sort keys should be sorted lexicographically in the culturally correct manner for the language specified by lang
"n" or "number" specifies that the sort keys should be converted to numbers and then sorted according to the numeric value; the lang attribute is ignored;

 

 

Either you can type the sort parameters in the "Sort" property field

sort_typing

 

or you can call the Sort dialog by clicking on threedots button.

repeat_sort

 

Examples:

cat

Sort by cat node in ascending order.

cat;price,d

Sort by cat node in ascending order then sort by price node in descending order.

cat,d;price

Sort by cat node in descending order then sort by price node in ascending order.

cat,,u,en

Sort by cat node in ascending order according to English language. Upper case character come first.

@id,,,,n

Sort by @id attribute of item node. data-type is "number" which means @id values will be converted numbers before sorting.

 

For Each:

 

/products/item

 

 

XML Data:

 

 

 <root>

  <products>

    <item id="7">

      <cat>Computer</cat>

      <description>Notebook Computer PIII 800Mhz</description>

      <price>1200</price>

    </item>

    <item id="22">

      <cat>Computer</cat>

      <description>Desktop Computer P4 2.4GHz</description>

      <price>1400</price>

    </item>

    <item id="908">

      <cat>Printer</cat>

      <description>Laser Printer 1200dpi, 12pps</description>

      <price>800</price>

    </item>

  </products>

  </root>

 

 

See Repeat Property.