I am developing a search and transform engine.
Stage one ( XQuery ): It returns the search response snippet based on the
point-in-time criteria from the UI:
<search:response xmlns:search="http://marklogic.com/appservices/search">
<search:result index="1" uri="/a.xml" path="fn:doc('/a.xml')">
<search:snippet>
<search:match
path="fn:doc('/a.xml')//*:putCurrencyAmount/*:currency">
<search:highlight>USD</search:highlight>
</search:match>
<search:match path="fn:doc('/a.xml')//*:putCurrencyAmount/*:amount">
<search:highlight>26000000</search:highlight>
</search:match>
</search:snippet>
</search:result>
<search:result index="2" uri="/b.xml" path="fn:doc('/b.xml')">
<search:snippet>
<search:match
path="fn:doc('/b.xml')//*:putCurrencyAmount/*:currency">
<search:highlight>USD</search:highlight>
</search:match>
<search:match path="fn:doc('/b.xml')//*:putCurrencyAmount/*:amount">
<search:highlight>38500000</search:highlight>
</search:match>
</search:snippet>
</search:result></search:response>
Stage Two ( XSLT + XQuery ): The returned artifacts (@uri,
@path,search:highlight, document content) will be incarnated in such way to
enrich the transformed results back to the UI with underlying document
untouched.
The significance of Stage Two is to expose the data based on UI request: if
one wants XML format, I transform the results to XML; if JSON format, transform
the results to JSON.
Below is the extraction of enriched result in JSON:
(point-in-time criteria = Rationale)
{ "Incarnation": { "Rationale": "Collection:product PAIR (putAmount:ultra-high && putCurrency:USD)", "Rendition": [ { "Trade": [ { "documentId": "/b.xml" }, { "Justification": [ { "path": "fn:doc(\"/b.xml\")//*:putCurrencyAmount/*:currency" }, { "highlight": "USD" }, { "path": "fn:doc(\"/b.xml\")//*:putCurrencyAmount/*:amount" }, { "highlight": "38500000" } ] }, { "trade": [
=================================== trade and other details extraction
============================ { "Trade": [ { "documentId": "/a.xml" }, { "Justification": [ { "path": "fn:doc(\"/a.xml\")//*:putCurrencyAmount/*:currency" }, { "highlight": "USD" }, { "path": "fn:doc(\"/a.xml\")//*:putCurrencyAmount/*:amount" }, { "highlight": "26000000" } ] }===================================
trade and other details extraction ============================
--~----------------------------------------------------------------
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
--~--