Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 373

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="hexBinary-method"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: The saxon:hexBinary 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:hexBinary serialization method"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>The saxon:hexBinary serialization method</h1>
      <p><i>Requires Saxon-PE</i></p>
      <p>An additional serialization method <code>saxon:hexBinary</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:hexBinary</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/}hexBinary".</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="image004.gif"/&gt;&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  &lt;xsl:result-document method="saxon:hexBinary" href="image004.gif" media-type="image/gif"&gt;
    &lt;xsl:text&gt;89504E470D0A1A0A0000000D49484452&lt;/xsl:text&gt;
    &lt;xsl:text&gt;0000000A0000000A08060000008D32CF&lt;/xsl:text&gt;
    &lt;xsl:text&gt;BD0000000467414D410000B18F0BFC61&lt;/xsl:text&gt;
    &lt;xsl:text&gt;05000000097048597300000B1300000B&lt;/xsl:text&gt;
    &lt;xsl:text&gt;1301009A9C180000000774494D4507D6&lt;/xsl:text&gt;
    &lt;xsl:text&gt;06011739281D1757E20000001D744558&lt;/xsl:text&gt;
    &lt;xsl:text&gt;74436F6D6D656E740043726561746564&lt;/xsl:text&gt;
    &lt;xsl:text&gt;2077697468205468652047494D50EF64&lt;/xsl:text&gt;
    &lt;xsl:text&gt;256E0000005D4944415418D3BDCCBD0D&lt;/xsl:text&gt;
    &lt;xsl:text&gt;825000C4F11F74B4ECE0164CE0320EE0&lt;/xsl:text&gt;
    &lt;xsl:text&gt;2ECEC1083626843D2C4D5EC5D958BC10&lt;/xsl:text&gt;
    &lt;xsl:text&gt;5E67B8EA721F7FFEAD6E1F84CBCF0E1D&lt;/xsl:text&gt;
    &lt;xsl:text&gt;EBE12B5CC31C5EE1D6C4877728E1139E&lt;/xsl:text&gt;
    &lt;xsl:text&gt;75D757A309A5CAB630B688F7B0844773&lt;/xsl:text&gt;
    &lt;xsl:text&gt;74BEBE0C921A177B4AD98A0000000049&lt;/xsl:text&gt;
    &lt;xsl:text&gt;454E44AE426082&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 cannot appear in the middle of an <code>xs:hexBinary</code> value,
but the string can be split into multiple text nodes so long as each contains an even number of characters.</i></p>
      <p>It is of course possible to construct the hexBinary value programmatically. The extension function
    <a class="bodylink" href="../../extensions/functions/octetstohexbinary.xml">saxon:octets-to-hexBinary</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/base64Binary-method.xml">saxon:base64Binary</a> serialization method.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="ptree-method.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>