I found that libxslt does not support "data-type" and "order" as attribute value templates in xsl:sort. As a simple example, <xsl:sort data-type="{'number'}"> silently sorts the data as text. Furthermore, an invalid value for the data-type is treated as "number" instead of the default value of "text". Of course erroneous input should not guarantee a result one way or the other, but it seems to me that the intuitive behavior is that it should revert to the default. Similarly, an invalid value for "order" is treated as "descending" instead of the default value of "ascending". Using xsltNumberFormat in numbers.c as a guide, I patched xsltDoSortFunction in xsltutils.c to support attribute value templates for "data-type" and "order". Adding this support seemed to me like the "right thing to do", but of course I am biased because I need this feature so discussion is welcome. The only part I felt reservations about was cut-n-pasting code from preproc.c into xsltutils.c because now this code appears in two places so it is redundant. But I'm not sure how else to do it, except maybe by overhauling the whole treatment of "static" versus "dynamic" attribute value templates, which I am definitely not prepared to do. I also patched preproc.c and xsltutils.c to use the default value for an invalid "data-type" or "order". I do not feel strongly if you wish to remove this behavior, especially if there was a reason that it should behave the non-default way. Detail: given valid input, the flags for data-type and order are set to zero for default behavior and they are set to one for non-default behavior. But given invalid input, these flags were set to -1, which was interpreted elsewhere in the code as non-default behavior. I did not see that this value of -1 was used anywhere in the code, so I set them to zero when given invalid input to get the default behavior. I hope that made sense. Perhaps looking at the patch will help. Ken Neighbors
patch for xsl:sort attribute value templates