Sophie

Sophie

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

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="xsl-elements" page="merge" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: xsl:merge</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: xsl:merge"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>xsl:merge</h1>
      <p>The <code>xsl:merge</code> instruction is new in XSLT 3.0, and is first implemented in Saxon-EE 9.4. The purpose
         of the instruction is to allow streamed merging of two or more pre-sorted input files, but the current implementation
         in Saxon is unstreamed.</p>
      <p>Each kind of input source is described in an <code>xsl:merge-source</code> child element of the <code>xsl:merge</code>
         instruction; and the instances of that kind of input source are selected in a <code>xsl:merge-input</code> child
         of the <code>xsl:merge-source</code> element. The processing to be carried out on each group of input items sharing a value
         for the merge key is defined in a <code>xsl:merge-action</code> element.</p>
      <p>The following example merges a homogenous collection of log files, each already sorted by timestamp:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>
&lt;xsl:merge&gt;
  &lt;xsl:merge-source select="collection('log-collection')"&gt;
    &lt;xsl:merge-input select="events/event"/&gt;
    &lt;xsl:merge-key select="@timestamp" order="ascending"/&gt;
  &lt;/xsl:merge-source&gt;
  &lt;xsl:merge-action&gt;
    &lt;xsl:sequence select="current-group()"/&gt;
  &lt;/xsl:merge-action&gt;
&lt;/xsl:merge&gt;</code>
         </pre>
      </div>
      <p>The following example merges two log files with different internal structure:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>
&lt;xsl:merge&gt;
  &lt;xsl:merge-source select="doc('log1.xml')"&gt;
    &lt;xsl:merge-input select="transactions/transaction"/&gt;
    &lt;xsl:merge-key select="xs:dateTime(@date, @time)" order="ascending"/&gt;
  &lt;/xsl:merge-source&gt;
  &lt;xsl:merge-source select="doc('log2.xml')"&gt;
    &lt;xsl:merge-input select="eventdata/transfer"/&gt;
    &lt;xsl:merge-key select="@timestamp" order="ascending"/&gt;
  &lt;/xsl:merge-source&gt;
  &lt;xsl:merge-action&gt;
    &lt;xsl:apply-templates select="current-group()"/&gt;
  &lt;/xsl:merge-action&gt;
  &lt;/xsl:merge&gt;</code>
         </pre>
      </div>
      <p>The function <code>current-merge-inputs()</code> is not yet implemented.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="merge-action.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>