op:xpath( $column as item(), $path as xs:string ) as map:map
This function extracts a sequence of child nodes from a column with node values -- especially, the document nodes from a document join. The path is an XPath (specified as a string) to apply to each node to generate a sequence of nodes as an expression value.
Parameters | |
---|---|
$column | The name of the column from which to extract the child nodes. |
$path | An XPath (specified as a string) to apply to each node. |
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; op:from-literals(( map:entry("id", 1) => map:with("val", 2) => map:with("uri", "/employee1.json"), map:entry("id", 2) => map:with("val", 4) => map:with("uri", "/employee3.json"), map:entry("id", 3) => map:with("val", 6) => map:with("uri", "/expense4.json") )) => op:order-by("id") => op:join-doc(op:col("doc"), op:col("uri")) => op:select(("id", "val", "uri", op:as("EmployeeID", op:xpath("doc", "/(Employee/ID|Expenses/EmployeeID)")) )) => op:result()