Hi,

 I did try using xdmp:eval() and xdmp:value() , also xdmp:unpath() but
all these functions return the data from the whole database, but i
need the values from the data stored in a variable.
Eg:
let $content :="<books selector="//title"><book><title>C
&DS</title><price>100</price><volume>1</volume></book>
                                     <book><title>AI
</title><price>150</price><volume>3</volume></book>
                    </books>"

The element  books contains an attribute selector which specifies the
xpath.I need to get this xpath expression from selector attribute and
then get the respective nodes from $content based on Xpath.
(The $content value is not stored in database, as i need to modify the
XML and then store it.)


Thank you,




Date: Wed, 3 Dec 2008 22:55:48 -0800
From: "Danny Sokolsky" <[EMAIL PROTECTED]>
Subject: RE: [MarkLogic Dev General] i have d
To: "General Mark Logic Developer Discussion"
       <[email protected]>
Message-ID:
       <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset="us-ascii"

If you just want the title nodes from the database, the following query
will do that:

/books/book/title

You cannot bind an XPath to a variable--you can bind the results of an
XPath, but not the XPath itself.  If you need to use your string
variable as an XPath, you can use xdmp:eval or xdmp:value to construct a
new query from the string.

-Danny

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
NvoiceMarklogic
Sent: Wednesday, December 03, 2008 9:15 PM
To: [email protected]
Subject: [MarkLogic Dev General] i have dobt in xpath

Hi All,

I have a doubt in XPTH.
i have xml content in a variable and xpath is also in a node.
how i can get nodes form content using the xpath varaible.
can any one suggest me.


ex:
let $content :="<books><book><title>C
&DS</title><price>100</price><volume>1</volume></book>
                                     <book><title>AI
</title><price>150</price><volume>3</volume></book>
                    </books>"
let $path:="/books/book/title"

how i can get title node from content, can u help meout.

Thank you.

Note: i have near 10 xml files in my database with same structure.




regards
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to