Hi Paul,

$s//title/node() is retuning multiple nodes. I guess xdmp:quote is doing a 
string-join with "\n". Try the following instead:

    let $title2 := string-join($s//title/node()/xdmp:quote(.), '')

(untested)

Kind regards,
Geert

-----Oorspronkelijk bericht-----
Van: [email protected] 
[mailto:[email protected]] Namens Paul M
Verzonden: vrijdag 22 juli 2011 16:44
Aan: [email protected]
Onderwerp: [MarkLogic Dev General] json html

I have the following snippet:
let $s := <snippet><title>Some Title<b>bolded</b></title></snippet>
    let $articles := element articles {
    let $title := xdmp:quote($s//title)
    let $title2 := xdmp:quote($s//title/node())   
    return (element title {$title}, element title2 {$title2})
                            }
    return json:serialize($articles)

The above returns the following:
{"articles":{"title":"<title>Some Title<b>bolded</b></title>","title2":"Some 
Title\n<b>bolded</b>"}}

I would like title2 not to have \n. I don't think this is possible. So I could 
brute-force <title> tag out instead. Is there anything possible on the front 
that may be worth investigating.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to