[xsl] Creating a padded sort key: easier from elt sequence or string?

Subject: [xsl] Creating a padded sort key: easier from elt sequence or string?
From: Yves Forkl <Y.Forkl@xxxxxx>
Date: Tue, 25 Jul 2006 11:43:21 +0200
Hi,

I'm lucky to be able to define some XML structure largely according to the needs of (XSLT) processing.

I have strings of variable length consisting of numbers and letters separated by dots, like "3.11.A.9" or "3.2.B.7".

Each of these strings shall take the role of a value for a sort key, but only after padding each number with sufficient zeros in order to sort "3.11.A.9" after and not before "3.2.B.7" (then "3.02.B.7"). The letters are always single letters, and the numbers have no more than 3 digits.

My question is as follows: which XML representation is more convenient when trying to fulfil this task in XSLT 1.1?

1) a PCDATA element containing a string like the ones above

2) an element containing a sequence of PCDATA elements, one for each of the numbers and letters (the dot in between may be added during processing)

And what's the best way of going about implementing the creation of the padded sort keys in XSLT from the more favorable representation? Would the solution differ much in XSLT 2.0?

Any hints are very much appreciated.

Yves

Current Thread