RE: [xsl] xsl:sort

Subject: RE: [xsl] xsl:sort
From: April Fleming <AFleming@xxxxxxxxxxxx>
Date: Mon, 21 Jun 2004 15:15:11 -0400
Sorry, did not realize I was being vague....(never been accused of that
before ;)

When I say it does not work, I mean it does not sort by that attribute.
When the order by value is an attribute that exists in every row (ie. Ip,
device_name) then the results are sorted by that attribute, however, if the
order by value is "device_os" which does not exist in every row, the data
comes back unsorted. I would like for it to treat the nonexistent attributes
as attribute="", as you say that the standard defines, unfortunately that is
not what it is doing.

Thank you. 

April 


-----Original Message-----
From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx] 
Sent: Monday, June 21, 2004 3:06 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] xsl:sort 


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@xxxxxxxxxxxxxxxxxxxx
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


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--+--


Current Thread