The logic is to sort on the <search:highlight>:
<search:highlight> contains both string( /*:putCurrencyAmount/*:currency) and
decimal (/*:putCurrencyAmount/*:amount) value in the same parent element
(search:result/search:snippet). "sortAmount" is supposed to sort /*:amount
(in this search result, only two amount: 26000000 , 38500000) not the
/*:currency.
As explained, it is merely my imagination to produce <xsl:param
name="sortAmount"> : WITH or WITHOUT parameter, WITH or WITHOUT group-by, WITH
or WITHOUT "see any further sorting", WITH or WITHOUT anything...I am NOT able
to sort the amount using XSLT alone, it consistently renders the document with
lower-amount first even I specify "descending".
As you can see, with the help of the data engine, the document with
higher-amount stays on top in the UI.
Question One is how to sort <search:highlight> when its value is decimal (
string is ignored ),"descending" or "ascending", in PURE XSLT.
Question Two: I mentioned it is "Syntactic matter". Whenever I use
"xsl:for-each-group" or "current-grouping-key()", the data engine failed
miserably...Before I claim it is the bug of the data engine (I understand it
can't digest XSLT 3.0 and "current-grouping-key" is ONLY available in XSLT), I
want to ensure it is not a syntactic problem.
I can't help wondering how to expand the XSLT 2.0+ capabilities within the data
engine...
On Sunday, June 6, 2021, 3:32:14 p.m. EDT, Martin Honnen
martin(_dot_)honnen(_at_)gmx(_dot_)de
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
On 06.06.2021 19:34, Fiona Chen anonymousjuly1(_at_)yahoo(_dot_)ca wrote:
Question One: The conditional sort is based on the search:highlight, if
it is decimal, sort the putAmount and then incarnate the document.
Notice: The "Rationale" is that currency and amount must be paired. In
each search:snippet, the currency is one search:highlight while amount
another. I would imagine a pure XSLT conditional sort in below manner.
=====================================================
<xsl:param name="sortAmount">
<xsl:for-each select="highlight">
<xsl:sort select="if (normalize-space() castable as
xs:decimal) then descending
else ()"/>
</xsl:for-each>
</xsl:param>
What kind of value is sortAmount supposed to represent, a sequence of
sort values like the amount, a sequence of sort orders like "descending"?
<xsl:template match="result">
<xsl:variable name="doc" select="document(@uri)"/>
<xsl:element name="Trade">
<xsl:for-each-group select="." group-by="@uri">
<xsl:call-template name="sort-render">
<xsl:with-param name="sortAmt" select="$sortAmount"/>
<!-- <xsl:with-param name="uri"
select="current-grouping-key()"/> -->
</xsl:call-template>
</xsl:for-each-group>
</xsl:element>
</xsl:template>
<xsl:template name="sort-render">
<xsl:param name="sortAmt"/>
<!-- <xsl:param name="uri"/> -->
<Justification inDocument="{@uri}">
<xsl:for-each select="descendant::match">
<path><xsl:value-of select="@path"/></path>
<highlight><xsl:value-of select="highlight"/></highlight>
</xsl:for-each>
</Justification>
</xsl:template>
Can you explain where you want to sort? You create a parameter named
sortAmount and pass it on as sortAmt but I do not even see any further
sorting there that uses sortAmt.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--