| 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:00 AM | XQuery & XSLT Built-In & Modules Function Reference
Built-In: Extension - XSLT Functions
Function Summary
exsl:node-set | Returns a sequence of nodes based on the input object.
exsl:object-type | Returns a string that contains the type-name of the object passed as the argument.
xdmp:current-last | Returns the size of the current node list.
xdmp:current-position | Returns the position of the current item.
xdmp:format-number | Returns a formatted number value based on the picture argument.
Function Detail
exsl:node-set(
| $value as xs:anyAtomicType*
) as xs:string
Summary: Returns a sequence of nodes based on the input object. If the input is a sequence of nodes, it is returned as it is. If it is a node, it is simply returned as a singleton sequence. For all other atomic types, a text node is returned based on the string-value of the type. This was a useful function in XSLT 1.0 where "Result Tree Fragments" are returned as a result of xslt instruction. In XSLT 2.0, however, xslt instructions return sequences. This function is simply being provided for backward compatibility to existing applications.
Parameters:
$value : The given object `$value` which needs to be converted into sequence.
Usage Notes: This function is based on the EXSLT functions (http://www.exslt.org/).
Example:
    xquery version "1.0-ml";

    xdmp:xslt-eval(
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                       xmlns:exsl="http://exslt.org/common"
                       extension-element-prefixes="exsl"
                       version="2.0">
         <xsl:template match="/">
           <xsl:value-of select="count(exsl:node-set(//element()))" />
         </xsl:template>
       </xsl:stylesheet>
    ,
    document{
     <doc>
       <one />
       <two />
       <three />
       <four />
    </doc>})

    => 5
exsl:object-type(
| $value as atomic type
) as xs:string
Summary: Returns a string that contains the type-name of the object passed as the argument.
Parameters:
$value : The given object `$value` whose type needs to be found.
Usage Notes: This function is based on the EXSLT functions (http://www.exslt.org/).
Example:
    xquery version "1.0-ml";

    xdmp:xslt-eval(
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                       xmlns:exsl="http://exslt.org/common"
                       extension-element-prefixes="exsl"
                       version="2.0">
         <xsl:variable name="string" select="'fred'" />
         <xsl:variable name="number" select="93.7" />
         <xsl:variable name="boolean" select="true()" />
         <xsl:variable name="node-set" select="//element()" />
         <xsl:template match="/">
            ;
            <xsl:value-of select="exsl:object-type($string)" />;
            <xsl:value-of select="exsl:object-type($number)" />;
            <xsl:value-of select="exsl:object-type($boolean)" />;
            <xsl:value-of select="exsl:object-type($node-set)" />
         </xsl:template>
       </xsl:stylesheet>
    ,
    document{<doc/>})

    =>
         ;
         string;
         number;
         boolean;
         node-set
xdmp:current-last( ) as xs:integer
Summary: Returns the size of the current node list. This function is only available in XSLT; it is not available in XQuery.
Example:
    xquery version "1.0-ml";

    xdmp:xslt-eval(
    <xsl:stylesheet version="2.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xdmp="http://marklogic.com/xdmp">
     <xsl:template match="foo">
       <xsl:value-of select="xdmp:current-last()"/>
     </xsl:template>
    </xsl:stylesheet>,
    document{<foo>
               <a>hello</a>
               <b>there</b>
             </foo>})

    => 1
xdmp:current-position( ) as xs:integer
Summary: Returns the position of the current item. This function is only available in XSLT; it is not available in XQuery.
Example:
    xquery version "1.0-ml";

    xdmp:xslt-eval(
    <xsl:stylesheet version="2.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xdmp="http://marklogic.com/xdmp">
     <xsl:template match="/">
       <xsl:value-of select="xdmp:current-position()"/>
     </xsl:template>
    </xsl:stylesheet>,
    document{<foo>hello there</foo>})

    => 1
xdmp:format-number(
| $value as numeric,
| $picture as xs:string,
| $language as xs:string,
| $letter-value as xs:string,
| $ordchar as xs:string,
| $zero-padding as xs:string,
| $grouping-separator as xs:string,
| $grouping-size as xs:string
) as xs:string
Summary: Returns a formatted number value based on the picture argument. The difference between this function and the W3C standards `fn:format-number` function is that this function imitates the XSLT `xsl:number` instruction, which has richer formatting options than the `fn:format-number` function. This function can be used for spelled-out and ordinal numbering in many languages. This function is available in XSLT as well as in all dialects of XQuery.
Parameters:
$value : The given numeric `$value` that needs to be formatted. The type of this argument must be a numeric type (for example, xs:integer, xs:float, xs:double, or xs:decimal).
$picture : The desired string representation of the given numeric `$value`. The picture string is a sequence of characters, in which the characters represent variables such as, decimal-separator-sign, grouping-sign, zero-digit-sign, digit-sign, pattern-separator, percent sign and per-mille-sign. For details on the picture string, see http://www.w3.org/TR/xslt20/#date-picture-string. Unlike fn:format-number(), here the picture sting allows spelled-out (uppercase, lowercase and Capitalcase) formatting.
$language : The desired language for string representation of the numeric `$value`. An empty sequence must be passed in even if a user doesn't want to specifiy this argument.
$letter-value : Same as letter-value attribute in xsl:number. This argument is ignored during formatting as of now. It may be used in future. An empty sequence must be passed in even if a user doesn't want to specifiy this argument.
$ordchar : If $ordchar is "yes" then ordinal numbering is attempted. If this is any other string, including an empty string, then then cardinal numbering is generated. An empty sequence must be passed in even if a user doesn't want to specifiy this argument.
$zero-padding : Value of $zero-padding is used to pad integer part of a number on the left and fractional part on the right, if needed. An empty sequence must be passed in even if a user doesn't want to specifiy this argument.
$grouping-separator : Value of $grouping-separator is a character, used to groups of digits, especially useful in making long sequence of digits more readable. For example, 10,000,000- here "," is used as a separator after each group of three digits. An empty sequence must be passed in even if a user doesn't want to specify this argument.
$grouping-size : Represents size of the group, i.e. the number of digits before after which grouping separator is inserted. An empty sequence must be passed in even if a user doesn't want to specifiy this argument.
Usage Notes: Most, but not all formatting combinations work. The following table shows formatting options by language, and lists what is supported and what is not.
Language | Numeric Cardinals | Numeric Ordinals | Spelled Out Cardinals | Spelled Out Ordinals
--- | --- | --- | --- | ---
en | Yes | Yes | Yes | Yes
fr | Yes | Yes | Yes | No
it | Yes | Yes | Yes | No
de | Yes | No | Yes | Yes
ru | Yes | No | Yes | No
es | Yes | Yes | Yes | No
ar | Yes | Yes | Yes | No
zh | Yes | Yes | Yes | Yes
ko | Yes | Yes | Yes | Yes
fa | Yes | No | Yes | No
nl | Yes | Yes | Yes | Yes
ja | Yes | Yes | Yes | Yes
pt | Yes | Yes | Yes | No
Example:
    xdmp:format-number(29,"01","en","",(),'0',",",3),
    xdmp:format-number(09,"W","en","",(),'"',",",3),
    xdmp:format-number((5),"w","es",(),(),"0",",",3)
    =>
    29
    NINE
    cinco

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