xsl-list
[Top] [All Lists]

Re: xsl:sort

2004-06-21 12:05:35
At 2004-06-21 14:50 -0400, April Fleming wrote:
I am using xsl:sort to sort through rows of xml data, the code is dynamic so
that a user can specify what attribute to "order by".

Fine ... your approach in your message of working with the name of the attribute is fine provided that the attribute is not namespace qualified, in which case you have more work to do.

The problem is the
way that the xml data is formatted, optional attributes do not always exist,
so when i try to use one of these values in the <xsl:sort> it does not work
when all rows do not have that attribute.

How do you mean "does not work"? The standard is very well defined in this regard: if you do not have the attribute, the sort value is the empty string and all sorted items of the same value are presented in the result current node list in document order.

So the code works great if each
"row" has the given attribute, but does not if the row does not have the
attribute (like "device_os" below)   Any ideas?

Any ideas regarding what?

Let us know what do you want done with the rows for which there are no values, and we can give you our ideas about how to do what you want. It would be inappropriate to spend the time just guessing about what you need to have happen, as it is your application.

I hope this helps.

........................ Ken


--
Public training 3 days XSLT & 2 days XSL-FO: Phoenix,AZ 2004-08-23
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



<Prev in Thread] Current Thread [Next in Thread>