Re: [xsl] Multiple Sort Key Components

Subject: Re: [xsl] Multiple Sort Key Components
From: "Don Smith dsmith_lockesmith@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 5 Jun 2019 11:59:21 -0000
Thank you, Michael.B 

Sent from Yahoo Mail on Android

  On Wed, Jun 5, 2019 at 3:27 AM, Michael Kay
mike@xxxxxxxxxxxx<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:   Your first
sort key is position(). Every item in the input has a different value for
position(). The Nth sort key only affects the outcome if all sort keys before
the Nth have duplicate values. When there are no duplicates for the first sort
key, the second and third will therefore have no effect.
Michael KaySaxonica


On 5 Jun 2019, at 00:28, Don Smith dsmith_lockesmith@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
Hello,
I'm attempting to sort the content of a variable using multiple sort key
components and my last component (@range_length) doesn't take effect. Given
this input which reflects paragraphs in document order:
B <list_of_group_ranges>
B B B B B B B B B B B B B B B B B B B B B B B  <range comment_id="2"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
start_element="d34e70"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
end_element="d34e141"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
range_length="10"/>
B B B B B B B B B B B B B B B B B B B B B B B  <range comment_id="3"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
start_element="d34e70"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
end_element="d34e160"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
range_length="14"/>
B B B B B B B B B B B B B B B B B B B B B B B  <range comment_id="4"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
start_element="d34e70"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
end_element="d34e102"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
range_length="5"/>
B B B B B B B B B B B B B B B B B B B B B B B  <range comment_id="17"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
start_element="d34e174"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
end_element="d34e214"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
range_length="26"/>
B B B B B B B B B B B B B B B B B B B B B B B  <range comment_id="18"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
start_element="d34e174"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
end_element="d34e193"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
range_length="22"/>
B B B B B B B B B B B B B B B B B B B B B B B  <range comment_id="23"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
start_element="d34e203"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
end_element="d34e209"
B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B 
range_length="25"/>
</list_of_group_ranges>
I want to sort these according to 3 sort components:1. document order2.
@start_element value3. @range_length value
The code I'm using to sort is:
B B B B B B B B B B B B B B B B B B B B B B  <xsl:for-each
select="$list_of_group_ranges/*">B B B B 
B B B B B B B B B B B B B B B B B B B B B B B B B B B  <xsl:sort
select="position()"/>
B B B B B B B B B B B B B B B B B B B B B B B B B B B  <xsl:sort
select="@start_element"/>
B B B B B B B B B B B B B B B B B B B B B B B B B B B  <xsl:sort
data-type="number" order="descending"B 
select="@range_length"></xsl:sort>B B B B B B B B B B B B B B B B B B B B B B
 B B B B 
B B B B B B B B B B B B B B B B B B B B B B B B B B B  <xsl:copy-of
select="."/>
B B B B B B B B B B B B B B B B B B B B B B B  </xsl:for-each>
But the last sort component, @range_length, isn't taking effect as the <range>
elements with the same @start_element don't sort according to @range_length.
What am I missing?
Thanks
Don
XSL-List info and archiveEasyUnsubscribe(by email)

XSL-List info and archiveEasyUnsubscribe(by email)

Current Thread