| XQUERY/XSLT API DOCUMENTATION 4.2 |
All XQuery & XSLT Functions MarkLogic Built-In Functions Admin (xdmp:) AppServer (xdmp:) Classifier (cts:) Debug (dbg:) Document Conversion (xdmp:) Extension (xdmp:) Documents, Directories, Properties, and Locks Functions Extension Functions Function Values Functions HTTP Functions JSON Functions MarkLogic Server Functions Search Functions XML Functions XQuery Context Functions XSLT Functions map (map:) Math (math:) Profile (prof:) Search (cts:) cts:query Constructors Functions Geospatial Functions Geospatial Lexicon Functions Lexicon Functions Search Functions Search Clustering Functions Security (xdmp:) Server Monitoring (xdmp:) Spell (spell:) Update (xdmp:) XQuery Library Modules Admin Library (admin:) Actions Functions Appserver Functions Database Functions Forest Functions Group Functions Host Functions Mimetypes Functions Scheduler Functions Alerting (alert:) Elastic Compute Cloud (ec2:) Entity Enrichment (entity:) Flexible Replication (flexrep:) Geospatial Supporting Functions GEO Functions GeoRSS Functions GML Functions KML Functions MCGM Functions Information Studio (info:) Information Studio Developer (infodev:) Library Services (dls:) cts:query Constructor Functions Document Management Functions Document Update Functions Retention Policy Functions XInclude Functions Modular Documents XInclude Functions XPointer Functions PKI (pki:) Plugin (plugin:) Search (search:) Security-sec (sec:) Spelling Dictionary Management (spell:) Thesaurus (thsr:) Triggers (trgr:) Triggers Library (trgr:) WordProcessingML (ooxml:) ZIP Package (ooxml:) CPF Functions Content Processing Framework (cpf:) CSS Conversion (css:) DocBook Conversion (dbk:) Domains (dom:) Excel Conversion (excel:) Generic Conversion (cvt:) Links (lnk:) MSWord Conversion (msword:) PDF Conversion (pdf:) Pipelines (p:) Powerpoint Conversion (ppt:) XHTML Conversion (xhtml:) W3C-Standard Functions Accessor (fn:) AnyURI (fn:) Boolean (fn:) Context (fn:) DurationDateTime (fn:) Error and Trace (fn:) Node (fn:) Numeric (fn:) QName (fn:) Sequence (fn:) String (fn:) XSLT (fn:) W3C XQuery/XSLT Reference W3C XQuery Functions W3C XQuery Language W3C XSLT Language
This page was generated September 12, 2012 6:01 AM | XQuery & XSLT Built-In & Modules Function Reference
Module: Generic Conversion
The conversion module is part of the conversion processing pipeline. These functions provide some basic path manipulation functions. To use the conversion module as part of your own XQuery module, include the following line in your XQuery prolog: `import module namespace cvt = "http://marklogic.com/cpf/convert" at "/MarkLogic/conversion/convert.xqy";` You will need to ensure that the conversion module is loaded into the same modules database as the importing module. The library namespace prefix `cvt` is not predefined in the server.
Function Summary
cvt:basename | Return the filename part of the URI, cutting off any query strings or fragments.
cvt:basepath | Return the base path of the URI, cutting off the filename.
cvt:destination-uri | Construct the destination URI from the source URI using the following rules: The path prefix of the destination URI is the same as the source URI's.
cvt:part-uri | Construct the URI for the part using the following rules: The path prefix of the part URI is the same source URI's, followed by a subdirectory name.
cvt:save-converted-documents | Save a set of converted documents, with appropriate links.
Function Detail
cvt:basename(
| $uri as xs:string
) as xs:string
Summary: Return the filename part of the URI, cutting off any query strings or fragments.
Parameters:
$uri : The URI to manipulate.
Example:
      xquery version "1.0-ml";
      import module namespace cvt = "http://marklogic.com/cpf/convert"
    		  at "/MarkLogic/conversion/convert.xqy";

      cvt:basename( "http://example.com/a.path/myfile.doc" )

      => "myfile.doc"
cvt:basepath(
| $uri as xs:string
) as xs:string
Summary: Return the base path of the URI, cutting off the filename.
Parameters:
$uri : The URI to manipulate.
Example:
      xquery version "1.0-ml";
      import module namespace cvt = "http://marklogic.com/cpf/convert"
    		  at "/MarkLogic/conversion/convert.xqy";

      cvt:basepath( "http://example.com/a.path/myfile.doc" )

      => "http://example.com/a.path"
cvt:destination-uri(
| $uri as xs:string,
| $extension as xs:string
) as xs:string
Summary: Construct the destination URI from the source URI using the following rules: The path prefix of the destination URI is the same as the source URI's. The filename in the destination maps '.' to '_' and appends the given extension.
Parameters:
$uri : The URI to manipulate.
$extension : The extension to add, such as ".xml"
Example:
      xquery version "1.0-ml";
      import module namespace cvt = "http://marklogic.com/cpf/convert"
    		  at "/MarkLogic/conversion/convert.xqy";

      cvt:destination-uri("http://example.com/a.path/myfile.doc", ".xml")

      => "http://example.com/a.path/myfile_doc.xml"
cvt:part-uri(
| $uri as xs:string,
| $part as xs:string
) as xs:string
Summary: Construct the URI for the part using the following rules: The path prefix of the part URI is the same source URI's, followed by a subdirectory name. The subdirectory name is formed by mapping '.' to '_' in the source filename and appending '_parts' to it. The part's filename is unchanged, but any part path is removed.
Parameters:
$uri : The URI to manipulate.
$part : The part to append to the URI. Only the filename is appended; any subdirectories preceding the filename are removed.
Example:
      xquery version "1.0-ml";
      import module namespace cvt = "http://marklogic.com/cpf/convert"
    		  at "/MarkLogic/conversion/convert.xqy";

      cvt:part-uri("http://example.com/a.path/myfile.doc",
                   "images/image1.jpg")

      => "http://example.com/a.path/myfile_doc_parts/image1.jpg"
cvt:save-converted-documents(
| $source-uri as xs:string,
| $destination-uri as xs:string,
| $manifest as element(),
| $docs as document-node()*
) as empty-sequence()
Summary: Save a set of converted documents, with appropriate links. If there is a main document, it must be the first listed in the manifest. The order in the manifest (as in xdmp:xxx-convert) must match the order of document nodes. Any cleaning or other preprocessing of the documents must already have been done. If certain parts should have been created in a certain state or with other initial properties, that must be done after the call to this function.
Parameters:
$source-uri : The URI of the source document.
$destination-uri : The URI of the root destination (converted) document.
$manifest : The parts list of all the conversion products, as returned by xdmp:pdf-convert, xdmp:word-convert, etc. The main or root document should be the first on the list, if there is one.
$docs : The documents produced by conversion, in the same order as in the manifest.
Example:
      xquery version "1.0-ml";
      import module namespace cvt = "http://marklogic.com/cpf/convert"
    		  at "/MarkLogic/conversion/convert.xqy";

      let $results := xdmp:word-convert( doc("myfile.doc"), "myfile.doc" )
      return
         cvt:save-converted-documents("myfile.doc", "myfile.doc",
            $results[1], $results[2 to last()] )

© Copyright 2002-2012 MarkLogic Corporation. All rights reserved.