Hi Pragya,

Looks like nobody answered this question yet. I notice some suspicious lines:

>   common:removepunct(xdmp:unquote(
>
>     $XML-STRING, $rule $NAMESPACE,
>
>     if ($LANGUAGE) then concat('default-language=', $LANGUAGE) else ()
>
>
>
>   )),

In those lines you pass multiple arguments to xdmp:unquote, and only one to 
common:removepunct. I would actually expect this to result in a syntax error. I 
think your intention is to pass only $XML-STRING into the unquote function.

I also see there is no comma between $rule and $NAMESPACE. That should give a 
syntax error as well..

Kind regards,
Geert

>


drs. G.P.H. (Geert) Josten
Consultant

Daidalos BV
Hoekeindsehof 1-4
2665 JZ Bleiswijk

T +31 (0)10 850 1200
F +31 (0)10 850 1199

mailto:[email protected]
http://www.daidalos.nl/

KvK 27164984


De informatie - verzonden in of met dit e-mailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.

> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Pragya Kapoor
> Sent: maandag 25 oktober 2010 13:49
> To: [email protected]
> Subject: [MarkLogic Dev General] Content Module in record loader
>
> Hi,
>
> I need to remove the punctuations(,.:;) from the title
> element . Using the following code  in record loader content module:
>
> xquery version "1.0-ml";
>
>
>
> declare variable $URI as xs:string external;
>
> declare variable $XML-STRING as xs:string external;
>
> declare variable $NAMESPACE as xs:string external;
>
> declare variable $LANGUAGE as xs:string external;
>
> declare variable $ROLES-EXECUTE as xs:string external;
>
> declare variable $ROLES-INSERT as xs:string external;
>
> declare variable $ROLES-READ as xs:string external;
>
> declare variable $ROLES-UPDATE as xs:string external;
>
> declare variable $COLLECTIONS as xs:string external;
>
> declare variable $SKIP-EXISTING as xs:boolean external;
>
> declare variable $ERROR-EXISTING as xs:boolean external;
>
> declare variable $FORESTS as xs:string external;
>
>
>
> declare function common:removepunct($node as node(), $rule as
> element(rule)) as node() {
>
>
>
>
>
>         for $n in $node return typeswitch ($n)
>
>           case element(title) return element {
>
>
>
>             fn:QName(fn:namespace-uri($n), fn:local-name($n) )
>
>           } {
>
>                     $n/@*,
>
>             fn:normalize-space(fn:replace(fn:data($n/title),
> $rule/punctuations/text(), '')),
>
>             common:removepunct($n/node(),$rule) }
>
>           case document-node() return document {
> common:removepunct($n)/node(), $rule) }
>
>   default return $n
>
> };
>
>
>
> xdmp:document-insert(
>
>   $URI,
>
>   common:removepunct(xdmp:unquote(
>
>     $XML-STRING, $rule $NAMESPACE,
>
>     if ($LANGUAGE) then concat('default-language=', $LANGUAGE) else ()
>
>
>
>   )),
>
>   (
>
>     for $r in tokenize($ROLES-EXECUTE, ',')[. ne '']
>
>     return xdmp:permission($r, 'execute'),
>
>     for $r in tokenize($ROLES-INSERT, ',')[. ne '']
>
>     return xdmp:permission($r, 'insert'),
>
>     for $r in tokenize($ROLES-READ, ',')[. ne '']
>
>     return xdmp:permission($r, 'read'),
>
>     for $r in tokenize($ROLES-UPDATE, ',')[. ne '']
>
>     return xdmp:permission($r, 'update')
>
>   ),
>
>   tokenize($COLLECTIONS, ',')[. ne ''],
>
>   0,
>
>   for $id in tokenize($FORESTS, ',')[. ne '']
>
>   return xs:unsignedLong($id)
>
> )
>
>
>
> But this code is not removing the punctuations. Please let me
> know where I am wrong.
>
>
>
> Thanks,
>
> Pragya
>
> **************** CAUTION - Disclaimer ***************** This
> e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION
> intended solely for the use of the addressee(s). If you are
> not the intended recipient, please notify the sender by
> e-mail and delete the original message. Further, you are not
> to copy, disclose, or distribute this e-mail or its contents
> to any other person and any such actions are unlawful. This
> e-mail may contain viruses. Infosys has taken every
> reasonable precaution to minimize this risk, but is not
> liable for any damage you may sustain as a result of any
> virus in this e-mail. You should carry out your own virus
> checks before opening the e-mail or attachment. Infosys
> reserves the right to monitor and review the content of all
> messages sent to or from this e-mail address. Messages sent
> to or from this e-mail address may be stored on the Infosys
> e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to