Re: [MarkLogic Dev General] Searching elements

2015-05-07 Thread Asitmohan Nautiyal



Hi Chad,


One more sample code 



let $qtext := "Biology"
return
cts:search(//subj-group,
   cts:and-query((
      cts:collection-query("content"),
     cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"), "heading"),
     cts:element-word-query(xs:QName("subject"), $qtext)
     )))




Regards,
Asit Nautiyal


From: Asitmohan Nautiyal
Sent: Friday, May 08, 2015 9:58 AM
To: MarkLogic Developer Discussion
Subject: RE: [MarkLogic Dev General] Searching elements




Hi Chad,


Please find the below sample code and I hope this will work for you sure :) 



let $qtext := "Biology"
return
cts:search(fn:collection("content")//subj-group,cts:and-query((
 cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"), "heading"), cts:element-word-query(xs:QName("subject"), $qtext)
)))




Regards,
Asit Nautiyal


From: general-boun...@developer.marklogic.com [general-boun...@developer.marklogic.com] on behalf of Chad Bishop [cbis...@sciencesocieties.org]
Sent: Thursday, May 07, 2015 10:43 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Searching elements





Hello,
 
I have a follow up question, regarding searching a specific element.
 
The suggestions provided were very helpful, but they don’t search for a specific element within a path (as far as I can tell).
 
I’m getting results, but the problem is we have multiple elements with the name of “subject”.  So the search is returning results for all elements named “subject”,
 rather than the specific “subject” element I’m looking for.
 
For example:
 

Cell biology & molecular genetics
Crop genetics
Plant genetic resources
Production agriculture
Crop quality


Beyond the Yield Curves: Exerting the Power of Genetics, Genomics, and Synthetic Biology

 
I’d really only like to search and return results for the green element above.
 
I’m using the following query now and it’s searching all  elements and returning them:
 
let $qtext := "Crop"
let $q := cts:and-query((cts:collection-query("content"), cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"), "heading"),
 cts:element-word-query(xs:QName("subject"), $qtext)))
return cts:element-values(xs:QName("subject"), (), (), $q)
 
How can I restrict it to a specific path/element?
 
Thanks much!
 
-Chad
 


From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com]
On Behalf Of Chad Bishop
Sent: Wednesday, May 06, 2015 9:09 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Searching elements


 
Thank you all for your responses and help.
 
I’ll give those a try.
 
Thanks again,
 
-Chad
 
From:
general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com]
On Behalf Of Indrajeet Verma
Sent: Wednesday, May 06, 2015 12:49 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Searching elements
 

Hi Chad Bishop,

 





You can try using cts:element-values() as well to get distinct subject values based on your input,


let $qtext := "whatever search"


let $terms :=  fn:tokenize($qtext," ")


let $q := cts:and-query((


            cts:collection-query("content"),


            cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"),"heading"),


            cts:element-word-query(xs:QName("subject"), $terms)


            )) 


return cts:element-values(xs:QName("subject"), (), (), $q)

If you want exact subject values, use cts:element-value-query and case-insensitive option OR cts:element-range-query 

Note - You would need to create range index for the subject to run above code.


Regards,
Indy




 







 



 

On Wed, May 6, 2015 at 9:17 AM, Asitmohan Nautiyal  wrote:



Hi Chad,


 



For searching a specific element and returning the matching values of that element use cts:element-value-query() function. Please refer
https://docs.marklogic.com/cts:element-value-query  


 


Avoid use  fn:distinct-values() function as its again a expensive in terms of performance. Use cts:values() function to get distinct terms from  a specified element.
 Refer https://docs.marklogic.com/cts:values


 



sample code is here :


 


cts:values(cts:path-reference("*:subject,"http://marklogic.com/collation//S2"),(),(),


cts:and-query((


cts:collection-query("content"),



cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"),xs:string(heading)


 


 


Note : Create path range index for subject element in your database.



 


 


Regards,


Asit Nautiyal






From:
general-boun...@developer.marklogic.com [general-boun...@developer.marklogic.com] on behalf of Chad Bishop
 [cbis...@sciencesocieties.org]
Sent: Wednesday, May 06, 2015 3:04 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Searching elements





Greetings,
 
I’m wondering if someone can help with the best way to approach searching a s

Re: [MarkLogic Dev General] Searching elements

2015-05-07 Thread Asitmohan Nautiyal



Hi Chad,


Please find the below sample code and I hope this will work for you sure :) 



let $qtext := "Biology"
return
cts:search(fn:collection("content")//subj-group,cts:and-query((
 cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"), "heading"), cts:element-word-query(xs:QName("subject"), $qtext)
)))




Regards,
Asit Nautiyal


From: general-boun...@developer.marklogic.com [general-boun...@developer.marklogic.com] on behalf of Chad Bishop [cbis...@sciencesocieties.org]
Sent: Thursday, May 07, 2015 10:43 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Searching elements





Hello,
 
I have a follow up question, regarding searching a specific element.
 
The suggestions provided were very helpful, but they don’t search for a specific element within a path (as far as I can tell).
 
I’m getting results, but the problem is we have multiple elements with the name of “subject”.  So the search is returning results for all elements named “subject”,
 rather than the specific “subject” element I’m looking for.
 
For example:
 

Cell biology & molecular genetics
Crop genetics
Plant genetic resources
Production agriculture
Crop quality


Beyond the Yield Curves: Exerting the Power of Genetics, Genomics, and Synthetic Biology

 
I’d really only like to search and return results for the green element above.
 
I’m using the following query now and it’s searching all  elements and returning them:
 
let $qtext := "Crop"
let $q := cts:and-query((cts:collection-query("content"), cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"), "heading"),
 cts:element-word-query(xs:QName("subject"), $qtext)))
return cts:element-values(xs:QName("subject"), (), (), $q)
 
How can I restrict it to a specific path/element?
 
Thanks much!
 
-Chad
 


From: general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com]
On Behalf Of Chad Bishop
Sent: Wednesday, May 06, 2015 9:09 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Searching elements


 
Thank you all for your responses and help.
 
I’ll give those a try.
 
Thanks again,
 
-Chad
 
From:
general-boun...@developer.marklogic.com [mailto:general-boun...@developer.marklogic.com]
On Behalf Of Indrajeet Verma
Sent: Wednesday, May 06, 2015 12:49 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Searching elements
 

Hi Chad Bishop,

 





You can try using cts:element-values() as well to get distinct subject values based on your input,


let $qtext := "whatever search"


let $terms :=  fn:tokenize($qtext," ")


let $q := cts:and-query((


            cts:collection-query("content"),


            cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"),"heading"),


            cts:element-word-query(xs:QName("subject"), $terms)


            )) 


return cts:element-values(xs:QName("subject"), (), (), $q)

If you want exact subject values, use cts:element-value-query and case-insensitive option OR cts:element-range-query 

Note - You would need to create range index for the subject to run above code.


Regards,
Indy




 







 



 

On Wed, May 6, 2015 at 9:17 AM, Asitmohan Nautiyal  wrote:



Hi Chad,


 



For searching a specific element and returning the matching values of that element use cts:element-value-query() function. Please refer
https://docs.marklogic.com/cts:element-value-query  


 


Avoid use  fn:distinct-values() function as its again a expensive in terms of performance. Use cts:values() function to get distinct terms from  a specified element.
 Refer https://docs.marklogic.com/cts:values


 



sample code is here :


 


cts:values(cts:path-reference("*:subject,"http://marklogic.com/collation//S2"),(),(),


cts:and-query((


cts:collection-query("content"),



cts:element-attribute-value-query(xs:QName("subj-group"), xs:QName("subj-group-type"),xs:string(heading)


 


 


Note : Create path range index for subject element in your database.



 


 


Regards,


Asit Nautiyal






From:
general-boun...@developer.marklogic.com [general-boun...@developer.marklogic.com] on behalf of Chad Bishop
 [cbis...@sciencesocieties.org]
Sent: Wednesday, May 06, 2015 3:04 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Searching elements





Greetings,
 
I’m wondering if someone can help with the best way to approach searching a specific element and returning the matching values of that element.
 
I figured xpath would be best so set this up:
 
let $term1 := "what"
let $term2 := "ever"
 
let $subjects := fn:collection("content")/article/front/article-meta/article-categories/subj-group[@subj-group-type = "heading"]/subject[fn:contains(., $term1) and fn:contains(., $term2)]
 
for $subject in fn:distinct-values($subjects)
return $subject
 
However, the number of terms will be variable, so I created this:
 
let $qtext := "whatev

Re: [MarkLogic Dev General] external auth

2015-05-07 Thread Jason Hunter
Be very careful in putting the REST API on a port with public access.  If you 
do, anyone with database credentials will be able to have direct access to the 
database.  The REST API isn't intended for public exposure.  Same as an XDBC 
port, it's for internal access.

-jh-

On May 8, 2015, at 1:40 AM, David Ennis  wrote:

> HI.
> 
> This type of scenario seems very possible with the Enhanced HTTP erver 
> configuration options available in Version 8. One of the most obvious 
> out-of-the-box benefits of the new server rewrite engine is the fact that you 
> need not have a separate port for your web app and REST API, for example. 
> Consider also that you have control over quite a bit - including switching 
> module databases and content databases as part of the rewrite rules - which 
> may be of benefit to you for what you describe.   
> 
> http://developer.marklogic.com/features/enhanced-http
> 
> 
> 
> 
> 
> 
> 
> Kind Regards,
> David Ennis
> 
> 
> David Ennis
> Content Engineer
> 
>  
> Mastering the value of content
> creative | technology | content
> 
> Delftechpark 37i
> 2628 XJ Delft
> The Netherlands
> T: +31 88 268 25 00
> M: +31 63 091 72 80 
> 
>
> 
> On 7 May 2015 at 17:28, cyanline llc  wrote:
> Hello,
>Looking for a bit of philosophical help here. We're deploying
> rest-apps with Roxy to one site. We have built a second site where users
> register, login, and perform a number of actions. Then, when the user is
> ready to use the marklogic rest-app, we pass them from the second site
> to the marklogic site.
>We would like that the user need not authenticate themselves again
> *and* that a user only has access to their rest-app, but not the others.
>With this current setup, we can see that we either need to pass the
> session data from one server to another, or have a third-party server
> track and share session data with the other 2 servers (ie ldap).
>Is ldap the way to go or are we way off with this current setup/there
> is a better way to do this?
> 
> Thank you
> 
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
> 
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at: 
> http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] external auth

2015-05-07 Thread David Lee
I may be misunderstanding but I see "session data" and "REST" in the same 
paragraph.
What exactly do you mean by "session data".
REST Services are not intended, nor directly manage server 'session state' of 
the sort that is associated with Browser/interactive 'session'
( e.g. if you use xdmp:set-session-field() that creates a 'Session' which is 
managed by browser cookies)

You can have both browser based sessions and do rest from JS calls - but you 
should not depend on, or attempt to make use of 'session state' from REST calls 
- if it happens to work that is something that's not supported and may or may 
not work in the future or in a different configuration.

That out of the way - assuming your talking about some other kind of 'session 
state'  - maybe a database document which you pass the URL through on REST 
calls ... that is a perfect use for the Enhanced HTTP server.
It can be configured to switch DB, Modules DB, add and remove query params, 
enforce additional security checks, switch between HTML,XML, JSON error 
formats, change error handlers ... and of course 'rewrite' the URL.   REST, 
HTTP, XCC can all interop on the same port - in the same or different 
'applications'.   These choices can be based on any header or URI path 
component or query param, as well as many of the 'request state' values 
available (user id, name, database etc.).

If your using a REST server which is created by the REST APIS' s then you will 
need to modify the generated rewriter - carefully - so as not to break the 
existing REST library infrastructure.



-
David Lee
Lead Engineer
MarkLogic Corporation
d...@marklogic.com
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.com

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of David Ennis
Sent: Thursday, May 07, 2015 1:40 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] external auth

HI.

This type of scenario seems very possible with the Enhanced HTTP erver 
configuration options available in Version 8. One of the most obvious 
out-of-the-box benefits of the new server rewrite engine is the fact that you 
need not have a separate port for your web app and REST API, for example. 
Consider also that you have control over quite a bit - including switching 
module databases and content databases as part of the rewrite rules - which may 
be of benefit to you for what you describe.

http://developer.marklogic.com/features/enhanced-http







Kind Regards,
David Ennis


David Ennis
Content Engineer

[HintTech] 
Mastering the value of content
creative | technology | content

Delftechpark 37i
2628 XJ Delft
The Netherlands
T: +31 88 268 25 00
M: +31 63 091 72 80

[http://www.hinttech.com] 
[http://www.hinttech.com/signature/Twitter_HintTech.png] 
  
[http://www.hinttech.com/signature/Facebook_HintTech.png] 
  
[http://www.hinttech.com/signature/Linkedin_HintTech.png] 


On 7 May 2015 at 17:28, cyanline llc 
mailto:i...@cyanline.com>> wrote:
Hello,
   Looking for a bit of philosophical help here. We're deploying
rest-apps with Roxy to one site. We have built a second site where users
register, login, and perform a number of actions. Then, when the user is
ready to use the marklogic rest-app, we pass them from the second site
to the marklogic site.
   We would like that the user need not authenticate themselves again
*and* that a user only has access to their rest-app, but not the others.
   With this current setup, we can see that we either need to pass the
session data from one server to another, or have a third-party server
track and share session data with the other 2 servers (ie ldap).
   Is ldap the way to go or are we way off with this current setup/there
is a better way to do this?

Thank you

___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] external auth

2015-05-07 Thread David Ennis
HI.

This type of scenario seems very possible with the Enhanced HTTP erver
configuration options available in Version 8. One of the most obvious
out-of-the-box benefits of the new server rewrite engine is the fact that
you need not have a separate port for your web app and REST API, for
example. Consider also that you have control over quite a bit - including
switching module databases and content databases as part of the rewrite
rules - which may be of benefit to you for what you describe.

http://developer.marklogic.com/features/enhanced-http







Kind Regards,
David Ennis


David Ennis
*Content Engineer*

[image: HintTech]  
Mastering the value of content
creative | technology | content

Delftechpark 37i
2628 XJ Delft
The Netherlands
T: +31 88 268 25 00
M: +31 63 091 72 80

[image: http://www.hinttech.com] 
  


On 7 May 2015 at 17:28, cyanline llc  wrote:

> Hello,
>Looking for a bit of philosophical help here. We're deploying
> rest-apps with Roxy to one site. We have built a second site where users
> register, login, and perform a number of actions. Then, when the user is
> ready to use the marklogic rest-app, we pass them from the second site
> to the marklogic site.
>We would like that the user need not authenticate themselves again
> *and* that a user only has access to their rest-app, but not the others.
>With this current setup, we can see that we either need to pass the
> session data from one server to another, or have a third-party server
> track and share session data with the other 2 servers (ie ldap).
>Is ldap the way to go or are we way off with this current setup/there
> is a better way to do this?
>
> Thank you
>
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Searching elements

2015-05-07 Thread Christopher Hamlin
On Thu, May 7, 2015 at 1:13 PM, Chad Bishop 
wrote:

>  Hello,
>
>
>
> I have a follow up question, regarding searching a specific element.
>
>
>
> The suggestions provided were very helpful, but they don’t search for a
> specific element within a path (as far as I can tell).
>
>
>
Would a field based on a path provide what you need?
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Searching elements

2015-05-07 Thread Chad Bishop
Hello,

I have a follow up question, regarding searching a specific element.

The suggestions provided were very helpful, but they don’t search for a 
specific element within a path (as far as I can tell).

I’m getting results, but the problem is we have multiple elements with the name 
of “subject”.  So the search is returning results for all elements named 
“subject”, rather than the specific “subject” element I’m looking for.

For example:


Cell biology & molecular genetics
Crop genetics
Plant genetic resources
Production agriculture
Crop quality


Beyond the Yield Curves: Exerting the Power of Genetics, Genomics, and 
Synthetic Biology


I’d really only like to search and return results for the green element above.

I’m using the following query now and it’s searching all  elements and 
returning them:

let $qtext := "Crop"
let $q := cts:and-query((cts:collection-query("content"), 
cts:element-attribute-value-query(xs:QName("subj-group"), 
xs:QName("subj-group-type"), "heading"), 
cts:element-word-query(xs:QName("subject"), $qtext)))
return cts:element-values(xs:QName("subject"), (), (), $q)

How can I restrict it to a specific path/element?

Thanks much!

-Chad

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Chad Bishop
Sent: Wednesday, May 06, 2015 9:09 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Searching elements

Thank you all for your responses and help.

I’ll give those a try.

Thanks again,

-Chad

From: 
general-boun...@developer.marklogic.com
 [mailto:general-boun...@developer.marklogic.com] On Behalf Of Indrajeet Verma
Sent: Wednesday, May 06, 2015 12:49 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Searching elements

Hi Chad Bishop,


You can try using cts:element-values() as well to get distinct subject values 
based on your input,

let $qtext := "whatever search"

let $terms :=  fn:tokenize($qtext," ")

let $q := cts:and-query((

cts:collection-query("content"),

cts:element-attribute-value-query(xs:QName("subj-group"), 
xs:QName("subj-group-type"),"heading"),

cts:element-word-query(xs:QName("subject"), $terms)

))

return cts:element-values(xs:QName("subject"), (), (), $q)

If you want exact subject values, use cts:element-value-query and 
case-insensitive option OR cts:element-range-query

Note - You would need to create range index for the subject to run above code.
[Inline image 1]

Regards,
Indy





On Wed, May 6, 2015 at 9:17 AM, Asitmohan Nautiyal 
mailto:asitmoha...@hcl.com>> wrote:
Hi Chad,

For searching a specific element and returning the matching values of that 
element use cts:element-value-query() function. Please refer 
https://docs.marklogic.com/cts:element-value-query

Avoid use  fn:distinct-values() function as its again a expensive in terms of 
performance. Use cts:values() function to get distinct terms from  a specified 
element. Refer https://docs.marklogic.com/cts:values

sample code is here :

cts:values(cts:path-reference("*:subject,"http://marklogic.com/collation//S2"),(),(),
cts:and-query((
cts:collection-query("content"),
cts:element-attribute-value-query(xs:QName("subj-group"), 
xs:QName("subj-group-type"),xs:string(heading)


Note : Create path range index for subject element in your database.


Regards,
Asit Nautiyal

From: 
general-boun...@developer.marklogic.com
 
[general-boun...@developer.marklogic.com]
 on behalf of Chad Bishop 
[cbis...@sciencesocieties.org]
Sent: Wednesday, May 06, 2015 3:04 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Searching elements
Greetings,

I’m wondering if someone can help with the best way to approach searching a 
specific element and returning the matching values of that element.

I figured xpath would be best so set this up:

let $term1 := "what"
let $term2 := "ever"

let $subjects := 
fn:collection("content")/article/front/article-meta/article-categories/subj-group[@subj-group-type
 = "heading"]/subject[fn:contains(., $term1) and fn:contains(., $term2)]

for $subject in fn:distinct-values($subjects)
return $subject

However, the number of terms will be variable, so I created this:

let $qtext := "whatever search"
let $terms :=  fn:tokenize($qtext," ")
let $contains := for $term in $terms
 return
  if ($term != $terms[fn:last()])
  then fn:concat("fn:contains(., ", , $term, , ") and ")
  else fn:concat("fn:contains(., ", , $term, , ")")

let $containsText := fn:string-join($contains)

let $subjects := 
fn:collection("content")/article/front/article-meta/artic

[MarkLogic Dev General] external auth

2015-05-07 Thread cyanline llc
Hello,
   Looking for a bit of philosophical help here. We're deploying 
rest-apps with Roxy to one site. We have built a second site where users 
register, login, and perform a number of actions. Then, when the user is 
ready to use the marklogic rest-app, we pass them from the second site 
to the marklogic site.
   We would like that the user need not authenticate themselves again 
*and* that a user only has access to their rest-app, but not the others.
   With this current setup, we can see that we either need to pass the 
session data from one server to another, or have a third-party server 
track and share session data with the other 2 servers (ie ldap).
   Is ldap the way to go or are we way off with this current setup/there 
is a better way to do this?

Thank you

___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] How to add CDATA to xml content - reg.,

2015-05-07 Thread Florent Georges
  Hi,

  The instruction xsl:output contains information for the serializer,
would the XSLT processor be in charge of it.  Like in the first case
below.  In the second case, you take the output tree of the
transformation and use it to construct another tree (with the root
element descriptiveText).  So the serializer of the XSLT processor is
never used.  The output tree of the transformation is never serialized
to text, you use it directly in another tree.

  When you manipulate a "piece of XML" in XPath, XQuery or XSLT, you
manipulate a parsed version of it (an instance of XDM).  This is a
tree in memory, and it has forgotten about some non-relevant
properties from the lexical form it was parsed from (if ever), like
whether some text was wrapped in a CDATA section, or the order of the
attributes of one elements.

  So the first question to answer is probably whether why do you need
a CDATA section?  If you really do, then show us a minimal
reproduction of the problem with the options.

  Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/


On 7 May 2015 at 09:37, ? wrote:
> Hi Mary,
>
>
>
> Thanks for your response, but even after adding the prolog,
> the CDATA is not added to the elements. When we view the result xml,
> "" is not visible to the  or  element.
>
>
>
>
>
> I tried to use xslt transformation to add the CDATA to  the
> xml file. When we use the xslt to some XML structure, it is working fine.
> But when we wrap the xslt transformed content within some element, then the
> CDATA is wiping off (or it is invisible).
>
>
>
> Note: Our xquery module where we are trying to add the prolog / xslt is a
> library module, will it cause any impact of CDATA if we use in main  /
> library module.
>
>
>
> Please suggest.
>
>
>
> Note: we have specified to add the CDATA to all the  tag as highlighted
> below.
>
>
>
> XSLT Approach: (XSLT without wrapper element)
>
>
>
> let $xslt :=
>
>   http://www.w3.org/1999/XSL/Transform";
> version="2.0">
>
> 
>
> 
>
>   
>
> 
>
>   
>
> 
>
>   
>
> let $outputNode :=
>
>   
>
> product_description
>
> 
>
> Pokemon the Movie:
>
> 
>
>   
>
>
>
> return
>
>   xdmp:xslt-eval($xslt, $outputNode)/element()
>
>
>
> Output:
>
>
>
> 
> product_description
> 
> 
> 
> 
>
>
>
> XSLT Approach: (XSLT with wrapper element “descriptiveText”)
>
>
>
> let $xslt :=
>
>   http://www.w3.org/1999/XSL/Transform";
> version="2.0">
>
> 
>
> 
>
>   
>
> 
>
>   
>
> 
>
>   
>
> let $outputNode :=
>
>   
>
> product_description
>
> 
>
> Pokemon the Movie:
>
> 
>
>   
>
>
>
> return
>
> {
>
> xdmp:xslt-eval($xslt, $outputNode)/element()
>
> }
>
>
>
> Output:
>
>
>
> 
> 
> product_description
> 
> Pokemon the Movie:
> 
> 
> 
>
>
>
>
>
>
>
>
>
> Thanks & Regards,
>
> Santhosh
>
> WB MarkLogic Application Support
>
> Mobile:+91-9600025142 | VNET: 468645
>
>
>
> -Original Message-
> From: general-boun...@developer.marklogic.com
> [mailto:general-boun...@developer.marklogic.com] On Behalf Of Mary Holstege
> Sent: Tuesday, May 05, 2015 7:11 PM
> To: general@developer.marklogic.com
> Subject: Re: [MarkLogic Dev General] How to add CDATA to xml content - reg.,
>
>
>
>
>
> If you really want CDATA escaping for certain elements, you can use the
> output options to control this.
>
>
>
> See https://docs.marklogic.com/guide/app-dev/appserver-control#id_86940
>
> for how to set output options at the appserver level and
>
> https://docs.marklogic.com/guide/xquery/langoverview#id_71572 for how to do
> so on a query by query level using prolog options.
>
>
>
> In your case, putting this at the top of your query should do it:
>
>
>
> declare option xdmp:output "cdata-section-elements=text";
>
>
>
> Note, however, that testing this via QConsole won't be effective, because of
> the way QConsole works, its own serialization options will win out.
>
>
>
> //Mary
>
>
>
> On 05/05/2015 04:42 AM, Florent Georges wrote:
>
>>Hi,
>
>>
>
>>First I guess your question has nothing to do with the email you quote.
>
>>
>
>>You need to ask the question why you need CDATA.  You most likely
>
>> do not.  Why is the following result not good for you?
>
>>
>
>>  

Sample content of a P element.

> >> > >>Regards, > >> > > ___ > > General mailing list > > General@developer.marklogic.com > > Manage your subscription at: > > http://developer.marklogic.com/mailman/listinfo/general > > This e-mail and any files transmitted with it are for the sole use of the > intended recipient(s) and may contain confidential and privileged > information. If you are not the intended recipient(s), please reply to the > sender and destroy all copies of the original message. Any unauthorized > review, use, disclosure, dissemination, forwarding, printing or copying

Re: [MarkLogic Dev General] How to add CDATA to xml content - reg.,

2015-05-07 Thread Santhosh.Rajasekaran2
Hi Mary,



Thanks for your response, but even after adding the prolog, the 
CDATA is not added to the elements. When we view the result xml, "" is not visible to the  or  element.




I tried to use xslt transformation to add the CDATA to  the xml 
file. When we use the xslt to some XML structure, it is working fine. But when 
we wrap the xslt transformed content within some element, then the CDATA is 
wiping off (or it is invisible).

Note: Our xquery module where we are trying to add the prolog / xslt is a 
library module, will it cause any impact of CDATA if we use in main  / library 
module.

Please suggest.

Note: we have specified to add the CDATA to all the  tag as highlighted 
below.

XSLT Approach: (XSLT without wrapper element)

let $xslt :=
  http://www.w3.org/1999/XSL/Transform"; 
version="2.0">


  

  

  
let $outputNode :=
  
product_description

Pokemon the Movie:

  

return
  xdmp:xslt-eval($xslt, $outputNode)/element()

Output:


product_description





XSLT Approach: (XSLT with wrapper element "descriptiveText")

let $xslt :=
  http://www.w3.org/1999/XSL/Transform"; 
version="2.0">


  

  

  
let $outputNode :=
  
product_description

Pokemon the Movie:

  

return
{
xdmp:xslt-eval($xslt, $outputNode)/element()
}

Output:



product_description

Pokemon the Movie:












Thanks & Regards,

Santhosh

WB MarkLogic Application Support

Mobile:+91-9600025142 | VNET: 468645



-Original Message-
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Mary Holstege
Sent: Tuesday, May 05, 2015 7:11 PM
To: general@developer.marklogic.com
Subject: Re: [MarkLogic Dev General] How to add CDATA to xml content - reg.,





If you really want CDATA escaping for certain elements, you can use the output 
options to control this.



See https://docs.marklogic.com/guide/app-dev/appserver-control#id_86940

for how to set output options at the appserver level and

https://docs.marklogic.com/guide/xquery/langoverview#id_71572 for how to do so 
on a query by query level using prolog options.



In your case, putting this at the top of your query should do it:



declare option xdmp:output "cdata-section-elements=text";



Note, however, that testing this via QConsole won't be effective, because of 
the way QConsole works, its own serialization options will win out.



//Mary



On 05/05/2015 04:42 AM, Florent Georges wrote:

>Hi,

>

>First I guess your question has nothing to do with the email you quote.

>

>You need to ask the question why you need CDATA.  You most likely

> do not.  Why is the following result not good for you?

>

>  

Sample content of a P element.

> >Regards, > ___ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. ___ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general