<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="functions" page="intro" subpage="serialize"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: serialize</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: serialize"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>serialize</h1>
      <p>This function serializes the supplied node <code>$arg</code>, returning the serialized node as a string.</p>
      <p class="subhead">serialize($arg as node()) &#8594; xs:string</p>
      <table>
         <tr>
            <td width="470" align="left" colspan="4" style="border-top:solid 1px #3D5B96; ">
               <p>
                     <i>Arguments</i>
                  </p>
            </td>
         </tr>
         <tr>
            <td width="40">
               <p> </p>
            </td>
            <td width="80" valign="top">
               <p>$arg</p>
            </td>
            <td valign="top" width="150">
               <p>node()</p>
            </td>
            <td valign="top" width="200">
               <p>The node (typically a document or element node) to be serialized</p>
            </td>
         </tr>
         <tr>
            <td colspan="2"
                style="border-top:solid 1px #3D5B96; border-bottom:solid 1px #3D5B96;">
               <p>
                     <i>Result</i>
                  </p>
            </td>
            <td style="border-top:solid 1px #3D5B96; border-bottom:solid 1px #3D5B96;"
                colspan="2">
               <p>xs:string</p>
            </td>
         </tr>
      </table>
      <p class="subhead">serialize($arg as node(), $params as node()*) &#8594; xs:string</p>
      <table>
         <tr>
            <td width="470" align="left" colspan="4" style="border-top:solid 1px #3D5B96; ">
               <p>
                     <i>Arguments</i>
                  </p>
            </td>
         </tr>
         <tr>
            <td width="40">
               <p> </p>
            </td>
            <td width="80" valign="top">
               <p>$arg</p>
            </td>
            <td valign="top" width="150">
               <p>node()</p>
            </td>
            <td valign="top" width="200">
               <p>The node (typically a document or element node) to be serialized</p>
            </td>
         </tr>
         <tr>
            <td width="40">
               <p> </p>
            </td>
            <td width="80" valign="top">
               <p>$params</p>
            </td>
            <td valign="top" width="150">
               <p>node()*</p>
            </td>
            <td valign="top" width="200">
               <p>Serialization parameters</p>
            </td>
         </tr>
         <tr>
            <td colspan="2"
                style="border-top:solid 1px #3D5B96; border-bottom:solid 1px #3D5B96;">
               <p>
                     <i>Result</i>
                  </p>
            </td>
            <td style="border-top:solid 1px #3D5B96; border-bottom:solid 1px #3D5B96;"
                colspan="2">
               <p>xs:string</p>
            </td>
         </tr>
      </table>
      <p class="subhead">Links to W3C specifications</p>
      <p>Namespace: http://www.w3.org/2005/xpath-functions</p>
      <p>Applies to: XPath 3.0, XSLT 3.0, XQuery 3.0 (if enabled in Saxon: requires Saxon-PE or Saxon-EE)</p>
      <p>
            <a href="http://www.w3.org/TR/xpath-functions-30/#func-serialize" class="bodylink">XPath 3.0 Functions and Operators</a>
         </p>
      <p class="subhead">Notes on the Saxon implementation</p>
      <p>This function is specified in XPath 3.0,
         and is newly supported in Saxon 9.3, provided XPath 3.0 is enabled. It replaces the Saxon
      extension function <code>saxon:serialize</code>
         </p>
      <p>Serialization parameters are supplied by a sequence of nodes, in which the node name acts as the
      name of the serialization parameter, and its string value as the value of the parameter. This mechanism
      is based on that in an earlier draft of the XPath 3.0 specification: see 
      <a href="http://www.w3.org/TR/2009/WD-xpath-functions-11-20091215/#func-serialize"
            class="bodylink">here</a>
         </p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="serialize-json.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>