On 06.06.2021 19:34, Fiona Chen anonymousjuly1@xxxxxxxx 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.
=====================================================
B B B <xsl:param name="sortAmount">
B B B B B B B <xsl:for-each select="highlight">
B B B B B B B B B B B <xsl:sort select="if (normalize-space() castable as
xs:decimal) then descending
B B B B B B B B B B B B B B B else ()"/>
B B B B B B B </xsl:for-each>
B B B </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"?
B B B <xsl:template match="result">
B 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:for-each-group select="." group-by="@uri">
B B B B B B B B B B B B B B B <xsl:call-template name="sort-render">
B B B B B B B B B B B B B B B B B B B <xsl:with-param name="sortAmt"
select="$sortAmount"/>
B B B B B B B B B B B <!--B B B B B B B B <xsl:with-param name="uri"
select="current-grouping-key()"/> -->
B B B B B B B B B B B B B B B </xsl:call-template>
B B B B B B B B B B B </xsl:for-each-group>
B B B B B B B </xsl:element>
B B B </xsl:template>
B B B <xsl:template name="sort-render">
B B B B B B B <xsl:param name="sortAmt"/>
B <!--B B B B B B <xsl:param name="uri"/> -->
B B B B B B B <Justification inDocument="{@uri}">
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 <path><xsl:value-of select="@path"/></path>
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 </xsl:for-each>
B B B B B B B </Justification>
B B B </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.
|