[XQZone General] node parameter
Jason Hunter
jhunter at marklogic.com
Wed Jun 29 09:16:12 PDT 2005
I'm not entirely sure I understand your question, but the question I'm
going to answer is, "How do I do an xpath using strings that represent
the element names to match?" :)
Basically, you have two ways. First, you can do something like this:
/*[name(.) = "foo"]/*[name(.) = "bar"]
But where possible it's generally more efficient to do an xdmp:eval
where you construct a query as a string and evaluate it:
let $match := xdmp:eval(concat("/", $foo, "/", $bar))
...
-jh-
Farshad Farzan wrote:
> I have the following query, and I want to make it into a function that takes
> string parameters that will represent node address.
>
> How do I add combine two node variables to make the right node for example ,
>
>
>
> How to combine is xdmp:directory('/CDA/','infinity') and
> //i:patientRole//i:patient/i:name
> Where both or one will be passed as strings ??
>
>
> declare namespace i='urn:hl7-org:v3'
> <result> {
>
> for $dv in distinct-values( for $a in
> xdmp:directory('/CDA/','infinity')//i:patientRole//i:patient/i:name
> return concat(normalize-space( lower-case($a/i:given)),'
> ',normalize-space(lower-case($a/i:family)),'
> ',normalize-space(lower-case($a/i:suffix)) ))
> return <subresult> { $dv } </subresult>
> } </result>
>
> _______________________________________________
> General mailing list
> General at xqzone.marklogic.com
> http://xqzone.com/mailman/listinfo/general
>
More information about the General
mailing list