Re: [xsl] Conditional sort instruction as parameter within group && Syntactic matter of multilevel grouping | XSLT 2.0 | P2

Subject: Re: [xsl] Conditional sort instruction as parameter within group && Syntactic matter of multilevel grouping | XSLT 2.0 | P2
From: "Fiona Chen anonymousjuly1@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 6 Jun 2021 22:40:48 -0000
 The desired result is simple as:B 

<Incarnation>
B B  <Trade>
B B B B B  <Justification>
B B B B B B B B 
<path>fn:doc('/b.xml')//*:putCurrencyAmount/*:currency</path>
B B B B B B B B  <highlight>USD</highlight>
B B B B B B B B  <path>fn:doc('/b.xml')//*:putCurrencyAmount/*:amount</path>
B B B B B B B B  <highlight>38500000</highlight>
B B B B B  </Justification>
B B  </Trade>B B  <Trade>
B B B B B  <Justification>
B B B B B B B B 
<path>fn:doc('/a.xml')//*:putCurrencyAmount/*:currency</path>
B B B B B B B B  <highlight>USD</highlight>
B B B B B B B B  <path>fn:doc('/a.xml')//*:putCurrencyAmount/*:amount</path>
B B B B B B B B  <highlight>26000000</highlight>
B B B B B  </Justification>
B B  </Trade></Incarnation>

Let's put the document content incarnation aside for the moment and focus on
how to get the search:response sort on the  decimal value
@<search:highlight>.B 
This is my working module written in MarkLogic Java, XQuery and XSLT 2.0 API.
But sort is not working in Oxygen without ML:
B B B  <xsl:template match="response">
B B B B B B B  <xsl:element name="Incarnation">
B B B B B B B B B B B  <xsl:element name="Rationale"><xsl:value-of
select="$rationale"/></xsl:element>
B B B B B B B B B B B  <xsl:element name="total"><xsl:value-of
select="@total"/></xsl:element>
B B B B B B B B B B B  <xsl:choose>
B B B B B B B B B B B B B B B  <xsl:when test="xs:integer(@total) eq 0">
B B B B B B B B B B B B B B B B B B B  <xsl:element name="message">No matching
document found.</xsl:element>
B B B B B B B B B B B B B B B  </xsl:when>
B B B B B B B B B B B B B B B  <xsl:otherwise>
B B B B B B B B B B B B B B B B B B B  <xsl:element name="Rendition">
B B B B B B B B B B B B B B B B B B B B B B B  <xsl:apply-templates
select="result"/>
B B B B B B B B B B B B B B B B B B B  </xsl:element>
B B B B B B B B B B B B B B B  </xsl:otherwise>
B B B B B B B B B B B  </xsl:choose>
B B B B B B B  </xsl:element>
B B B  </xsl:template>

B B B  <xsl:template match="result">
B B B B B B  <xsl:variable name="doc" select="document(@uri)"/>
B B B B B B B  <xsl:element name="Trade">
B B B B B B B B B B B  <xsl:element name="documentId"><xsl:value-of
select="$doc/product:requestProduct/product:_metaData/product:docId"/></xsl:e
lement>
B B B B B B B B B B B  <Justification>
B B B B B B B B B B B B B B B  <xsl:for-each select="descendant::match">
B B B B B B B B B B B B B B B B B B B  <path><xsl:value-of
select="@path"/></path>
B B B B B B B B B B B B B B B B B B B  <highlight><xsl:value-of
select="highlight"/></highlight>
B B B B B B B B B B B B B B B  </xsl:for-each>
B B B B B B B B B B B  </Justification>
<!--B  ML failed here::
B B B B B B B  <xsl:for-each-group select="." group-by="@uri">
B B B B B B B B B B B B B B B  <Justification
inDocument="current-grouping-key()">
B B B B B B B B B B B B B B B B B B B  <xsl:for-each-group
select="current-group()" group-by="search:snippet">
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
select="descendant::search:match">
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  <path><xsl:value-of
select="@path"/></path>
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 
<highlight><xsl:value-of select="search:highlight"/></highlight>
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>
B B B B B B B B B B B B B B B B B B B  </xsl:for-each-group>
B B B B B B B B B B B B B B B  </Justification>
B B B B B B B B B B B  </xsl:for-each-group>B B B  -->
B B B B B B B B B B B  <xsl:copy-of
select="incarnation:render-def(fn:normalize-space(@uri))"/>
B B B B B B B  </xsl:element>
B B B  </xsl:template>

B B B  <xsl:template match="node()|@*"/>
So how can I get the sort on decimal value @"search:highlight" work?

Current Thread