Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 370

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="extensions" page="output-extras" subpage="base64Binary-method"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: The saxon:base64Binary serialization method</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: The saxon:base64Binary serialization method"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>The saxon:base64Binary serialization method</h1>
      <p><i>Requires Saxon-PE</i></p>
      <p>An additional serialization method <code>saxon:base64Binary</code> is available. This is intended to be useful when
creating binary output files, for example images. All serialization properties other than <code>method</code> are
ignored.</p>
      <p>As with the <code>text</code> output method, all nodes in the result tree other than text nodes are ignored. Each text node
must hold a string that is in the lexical space of the <code>xs:base64Binary</code> data type. The sequence of octets
corresponding to this base64 value is written to the binary output file.</p>
      <p>When invoking this method via an API, use the property value "{http://saxon.sf.net/}base64Binary".</p>
      <p>When using this serialization method, the <code>omit-xml-declaration</code> parameter is automatically
set to "yes".</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>&lt;xsl:template name="main"&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;An image&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;An image&lt;/h1&gt;
      &lt;p&gt;&lt;img src="image.gif"/&gt;&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  &lt;xsl:result-document method="saxon:base64Binary" href="image.gif" media-type="image/gif"&gt;
    &lt;xsl:text&gt;iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAA
        LEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IAAAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBH
        SU1Q72QlbgAAAF1JREFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jqch9//q1uH
        4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0vr4MkhoXe0rZigAAAABJRU5ErkJggg==
    &lt;/xsl:text&gt;
  &lt;/xsl:result-document&gt;
&lt;/xsl:template&gt;
</code>
         </pre>
      </div>
      <p><i>The image here displays as a small red dot. Note that whitespace can be freely inserted
into the base64Binary string.</i></p>
      <p>It is of course possible to construct the base64Binary value programmatically. The extension function
    <a class="bodylink" href="../../extensions/functions/octetstobase64binary.xml">saxon:octets-to-base64Binary</a> may be useful to achieve this.</p>
      <p>When writing output that is not entirely binary, but contains mixed binary and text, it may be more convenient
    to use the text output method with the <a class="bodylink" href="../../extensions/output-extras/recognize-binary.xml">saxon:recognize-binary</a> serialization property.</p>
      <p>See also the <a class="bodylink" href="../../extensions/output-extras/hexBinary-method.xml">saxon:hexBinary</a> serialization method.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="hexBinary-method.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>