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
--~--