Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is just a small example of what you <strong>could</strong> do:</p> <p><em>file1.xml:</em></p> <pre><code>&lt;foo&gt; &lt;bar&gt;Text from file1&lt;/bar&gt; &lt;/foo&gt; </code></pre> <p><em>file2.xml:</em></p> <pre><code>&lt;foo&gt; &lt;bar&gt;Text from file2&lt;/bar&gt; &lt;/foo&gt; </code></pre> <p><em>index.xml:</em></p> <pre><code>&lt;index&gt; &lt;filename&gt;file1.xml&lt;/filename&gt; &lt;filename&gt;file2.xml&lt;/filename&gt; </code></pre> <p></p> <p><em>summarize.xsl:</em></p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"&gt; &lt;xsl:variable name="big-doc-rtf"&gt; &lt;xsl:for-each select="/index/filename"&gt; &lt;xsl:copy-of select="document(.)"/&gt; &lt;/xsl:for-each&gt; &lt;/xsl:variable&gt; &lt;xsl:variable name="big-doc" select="exsl:node-set($big-doc-rtf)"/&gt; &lt;xsl:template match="/"&gt; &lt;xsl:element name="summary"&gt; &lt;xsl:apply-templates select="$big-doc/foo"/&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;xsl:template match="foo"&gt; &lt;xsl:element name="text"&gt; &lt;xsl:value-of select="bar"/&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Applying the stylesheet to <em>index.xml</em> gives you:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;summary&gt;&lt;text&gt;Text from file1&lt;/text&gt;&lt;text&gt;Text from file2&lt;/text&gt;&lt;/summary&gt; </code></pre> <p>The trick is to load the different documents with the document function (extension function supported by almost all XSLT 1.0 processors), to output the contents as part of a variable body and then to convert the variable to a node-set for further processing.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload