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?
<text><p>Sample content of a P element.</p></text>
Regards,
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
On 5 May 2015 at 10:15, ? wrote:
> Hi All,
>
>
>
> We need to add CDATA to our xml content. We followed below
> approach to add CDATA. But the out is coming as serialized xml, It is
> transforming the “<” to “<” and “>” to “>”
>
>
>
> Is there any option to get the output xml without the transformation.
>
>
>
> Code snippet to add the CDATA:
>
>
>
> <text>
>
> {
>
> fn:concat('<![CDATA[', xdmp:quote( <p>{ $description }</p> ), ']]>')
>
> }
>
> </text>
>
>
>
>
>
>
>
> Current Issue:
>
>
>
> <description>
>
> <type>product_description</type>
>
> <text><![CDATA[<p>Sample cdata content within para
> tag.</p><p>Deep in the heart of a mysterious forest, a Pokemon
> named Shaymin stumbles into the midst of a battle between two powerful
> Pokemon, Dialga and Giratina. </p>]]>
>
> </text>
>
> </description>
>
>
>
> Essentially we need to get rid of this entities and create simple elements
> like this below.
>
>
>
> <description>
>
> <type>product_description</type>
>
> <text>
>
> <![CDATA[<p> Sample cdata content within para tag.</p><p>Deep in the heart
> of a mysterious forest, a Pokemon named Shaymin stumbles into the midst of a
> battle between two powerful Pokemon, Dialga and Giratina. </p>]]>
>
> </text>
>
> </description>
>
>
>
>
>
> Thanks & Regards,
>
> Santhosh
>
>
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Asitmohan
> Nautiyal
> Sent: Tuesday, May 05, 2015 11:49 AM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Dynamic order by
>
>
>
> Hi Pragya,
>
>
>
> As per your requirement , you have to use if/else condition. Follow the
> below sample algo:
>
>
>
> for $each in $results//results/result (: $results//results/result ==>
> used // äs you mentioned AgreementType can be at any level or not :)
>
> return
>
> if($each/AgreementType) then
>
> if($sortDirection=""asc"") then
>
> order by $each/AgreementType ascending
>
> else order by $each/AgreementType descending
>
> else $results
>
>
>
>
>
> Now you can write own logic based on business conditions.
>
>
>
> Regards,
>
> Asit Nautiyal
>
> ________________________________
>
> From: [email protected]
> [[email protected]] on behalf of Kapoor, Pragya
> [[email protected]]
> Sent: Tuesday, May 05, 2015 9:34 AM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Dynamic order by
>
> Could someone help on this?
>
> ________________________________
>
> From: Kapoor, Pragya
> Sent: Monday, May 4, 2015 5:03 PM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Dynamic order by
>
>
>
> Thanks Asit.
>
> But I have different requirement.
>
> In your code :
>
> return if($sorting/sorting/sort) then
>
> for $each in $results//results/result
>
> order by $each/AgreementType descending , $each/CollectionNo ascending
>
> return $each (: modify as per your business requirement :)
>
> else $results
>
>
>
> In the order by clause you are using $each/AgreementType, but as mentioned
> in the mail the element AgreementType is not static. This value is dynamic
> moreover sort direction(asc/desc) is also dynamic.
>
>
> Thanks
>
> Pragya
>
>
>
> ________________________________
>
> From: [email protected]
> <[email protected]> on behalf of Asitmohan Nautiyal
> <[email protected]>
> Sent: Monday, May 4, 2015 4:40 PM
> To: MarkLogic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Dynamic order by
>
>
>
> Hi Pragya,
>
>
>
> try below sample code
>
>
>
> let $sorting :=<a> <sorting>
>
> <columnAlias>Currency</columnAlias>
>
> </sorting>
>
> <sorting>
>
> <sort>desc</sort>
>
> <columnAlias>AgreementType</columnAlias>
>
> </sorting>
>
> <sorting>
>
> <sort>asc</sort>
>
> <columnAlias>CollectionNo</columnAlias>
>
> </sorting></a>
>
>
>
> let $results :=
>
> <report>
>
> <columns>
>
> <title>Currency</title>
>
> <title>AgreementType</title>
>
> <title>CollectionNo</title>
>
> </columns>
>
> <results>
>
> <result>
>
> <Currency>US dollar</Currency>
>
> <AgreementType>abc</AgreementType>
>
> <CollectionNo>0000050</CollectionNo>
>
> </result>
>
> <result>
>
> <Currency>Pound sterling</Currency>
>
> <AgreementType>xyz</AgreementType>
>
> <CollectionNo>0000048</CollectionNo>
>
> </result>
>
> <result>
>
> <Currency>Euro</Currency>
>
> <AgreementType>ebf</AgreementType>
>
> <CollectionNo>0000049</CollectionNo>
>
> </result>
>
> </results>
>
> </report>
>
>
>
> return if($sorting/sorting/sort) then
>
> for $each in $results//results/result
>
> order by $each/AgreementType descending , $each/CollectionNo ascending
>
> return $each (: modify as per your business requirement :)
>
> else $results
>
>
>
>
>
> Regards,
>
> Asit Nautiyal
>
> ________________________________
>
> From: [email protected]
> [[email protected]] on behalf of Kapoor, Pragya
> [[email protected]]
> Sent: Monday, May 04, 2015 3:21 PM
> To: MarkLogic Developer Discussion
> Subject: [MarkLogic Dev General] Dynamic order by
>
> Hi,
>
>
>
> I need to sort the $results based on element columnAlias in $sorting.
>
>
>
> for eg :
>
> In the below scenario, I want to first sort the $results with
> AgreementType(desc) and then with CollectionNo(asc).If there is not <sort>
> element in $sorting/sorting then do not use that element <columnAlias> for
> sorting.
>
> Moreover the elements in $sorting & $results will be dynamic and not fixed.
>
>
>
> let $sorting :=<a> <sorting>
>
> <columnAlias>Currency</columnAlias>
>
> </sorting>
>
> <sorting>
>
> <sort>desc</sort>
>
> <columnAlias>AgreementType</columnAlias>
>
> </sorting>
>
> <sorting>
>
> <sort>asc</sort>
>
> <columnAlias>CollectionNo</columnAlias>
>
> </sorting></a>
>
>
>
> let $results :=
>
> <report>
>
> <columns>
>
> <title>Currency</title>
>
> <title>AgreementType</title>
>
> <title>CollectionNo</title>
>
> </columns>
>
> <results>
>
> <result>
>
> <Currency>US dollar</Currency>
>
> <AgreementType>abc</AgreementType>
>
> <CollectionNo>0000050</CollectionNo>
>
> </result>
>
> <result>
>
> <Currency>Pound sterling</Currency>
>
> <AgreementType>xyz</AgreementType>
>
> <CollectionNo>0000048</CollectionNo>
>
> </result>
>
> <result>
>
> <Currency>Euro</Currency>
>
> <AgreementType>ebf</AgreementType>
>
> <CollectionNo>0000049</CollectionNo>
>
> </result>
>
> </results>
>
> </report>
>
>
>
> Thanks
>
> Pragya
>
>
>
>
> "This e-mail and any attachments transmitted with it are for the sole use of
> the intended recipient(s) and may contain confidential , proprietary or
> privileged information. If you are not the intended recipient, please
> contact the sender by reply e-mail and destroy all copies of the original
> message. Any unauthorized review, use, disclosure, dissemination,
> forwarding, printing or copying of this e-mail or any action taken in
> reliance on this e-mail is strictly prohibited and may be unlawful."
>
>
>
> ::DISCLAIMER::
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> E-mail transmission is not guaranteed to be secure or error-free as
> information could be intercepted, corrupted,
> lost, destroyed, arrive late or incomplete, or may contain viruses in
> transmission. The e mail and its contents
> (with or without referred errors) shall therefore not attach any liability
> on the originator or HCL or its affiliates.
> Views or opinions, if any, presented in this email are solely those of the
> author and may not necessarily reflect the
> views or opinions of HCL or its affiliates. Any form of reproduction,
> dissemination, copying, disclosure, modification,
> distribution and / or publication of this message without the prior written
> consent of authorized representative of
> HCL is strictly prohibited. If you have received this email in error please
> delete it and notify the sender immediately.
> Before opening any email and/or attachments, please check them for viruses
> and other defects.
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
> "This e-mail and any attachments transmitted with it are for the sole use of
> the intended recipient(s) and may contain confidential , proprietary or
> privileged information. If you are not the intended recipient, please
> contact the sender by reply e-mail and destroy all copies of the original
> message. Any unauthorized review, use, disclosure, dissemination,
> forwarding, printing or copying of this e-mail or any action taken in
> reliance on this e-mail is strictly prohibited and may be unlawful."
>
> 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
> [email protected]
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general