The desired result is simple as:
<Incarnation>
<Trade>
<Justification>
<path>fn:doc('/b.xml')//*:putCurrencyAmount/*:currency</path>
<highlight>USD</highlight>
<path>fn:doc('/b.xml')//*:putCurrencyAmount/*:amount</path>
<highlight>38500000</highlight>
</Justification>
</Trade> <Trade>
<Justification>
<path>fn:doc('/a.xml')//*:putCurrencyAmount/*:currency</path>
<highlight>USD</highlight>
<path>fn:doc('/a.xml')//*:putCurrencyAmount/*:amount</path>
<highlight>26000000</highlight>
</Justification>
</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>.
This is my working module written in MarkLogic Java, XQuery and XSLT 2.0 API.
But sort is not working in Oxygen without ML:
<xsl:template match="response">
<xsl:element name="Incarnation">
<xsl:element name="Rationale"><xsl:value-of
select="$rationale"/></xsl:element>
<xsl:element name="total"><xsl:value-of
select="@total"/></xsl:element>
<xsl:choose>
<xsl:when test="xs:integer(@total) eq 0">
<xsl:element name="message">No matching document
found.</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="Rendition">
<xsl:apply-templates select="result"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<xsl:template match="result">
<xsl:variable name="doc" select="document(@uri)"/>
<xsl:element name="Trade">
<xsl:element name="documentId"><xsl:value-of
select="$doc/product:requestProduct/product:_metaData/product:docId"/></xsl:element>
<Justification>
<xsl:for-each select="descendant::match">
<path><xsl:value-of select="@path"/></path>
<highlight><xsl:value-of select="highlight"/></highlight>
</xsl:for-each>
</Justification>
<!-- ML failed here::
<xsl:for-each-group select="." group-by="@uri">
<Justification inDocument="current-grouping-key()">
<xsl:for-each-group select="current-group()"
group-by="search:snippet">
<xsl:for-each select="descendant::search:match">
<path><xsl:value-of select="@path"/></path>
<highlight><xsl:value-of
select="search:highlight"/></highlight>
</xsl:for-each>
</xsl:for-each-group>
</Justification>
</xsl:for-each-group> -->
<xsl:copy-of
select="incarnation:render-def(fn:normalize-space(@uri))"/>
</xsl:element>
</xsl:template>
<xsl:template match="node()|@*"/>
So how can I get the sort on decimal value @"search:highlight" work?
--~----------------------------------------------------------------
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
--~--