私はcsvファイルを持っています。mlcp を使用してこれらのデータを MarkLogic にインポートし、MarkLogic で xml ファイルを作成しました。
今csvで、列の1つにランダムに「6/29/2013 5:00:00 PM」という形式があります。xquery とおそらく node-replace を変換関数として使用して、この日付を MarkLogic のデフォルトの日付形式として「2013-06-29」などの別の形式に変換するにはどうすればよいですか?
どんな助けでも大歓迎です...
transform.xqy を作成し、MLogic のモジュールにインストールしました。「xdmp:node-replace」を使用して、日付を期待される形式に置き換えることを考えています。または、列ごとに csv 列を調べて (方法は?)、「castable as xs:dateTime」を使用して日付値を決定する必要があります。それでも、コンテンツの値/uriを出力するだけでも、常にエラーが発生します。
xquery version "1.0-ml";
module namespace example = "http://test.com/example";
(: If the input document is XML, insert @NEWATTR, with the value
: specified in the input parameter. If the input document is not
: XML, leave it as-is.
:)
declare function example:transform(
$content as map:map,
$context as map:map
) as map:map*
{
let $the-doc-uri := map:get($content, "uri")
let $the-doc := map:get($content, "value")
return
trace($the-doc, 'The value of doc is: ')
};