There are several ways to do this, but one is that you can do a test for the node name as an XPath predicate. Something like:
let $x := <foo><bar>bar</bar></foo> let $y := "bar" return $x/*[fn:node-name(.) = xs:QName($y)] The $y in this example can come in from some user input from the browser. -Danny -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ?????? ??????????? (Nagesh S) Sent: Thursday, September 25, 2008 4:13 PM To: [email protected] Subject: [MarkLogic Dev General] Querying when element name is not knownbeforehand Hi, My requirement is to query a doc where, I wouldn't know the element name until run-time as the name would be coming from the browser. Thus, based on the element name, different queries should be run. How do I achieve this ? Example : for $doc in doc('foo.xml")/rootElement where $doc/??? = some_data Since the ??? should be changed for values coming from browser, I should probably have a switch-case type of construct where different queries are run. Thanks, Nagesh _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
