Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If the input XML can be mapped to your XML format in a straight-forward way, then a set of XPath expressions would be required from the user.</p> <p>By "straight-forward way" I mean a very basic <code>&lt;xsl:apply-templates&gt;</code> approach. The input XML must have individual records that can be addressed unambiguously, containing all the data in the right format. No data would require calculating or other special processing any more complex than what can be achieved by the evaluation of a single XPath expression.</p> <p>If the input is:</p> <pre><code>&lt;root&gt; &lt;entry id="1" name"foo"&gt; &lt;data1&gt;somevalue &lt;data2&gt;othervalue&lt;/data2&gt; &lt;/data1&gt; &lt;/entry&gt; &lt;/root&gt; </code></pre> <p>and your desired output would be:</p> <pre><code>&lt;records&gt; &lt;record&gt; &lt;id&gt;1&lt;/id&gt; &lt;name&gt;foo&lt;/name&gt; &lt;data1&gt;somevalue&lt;/data1&gt; &lt;data2&gt;othervalue&lt;/data2&gt; &lt;/record&gt; &lt;/records&gt; </code></pre> <p>then the user would have to provide the following mappings:</p> <ul> <li>root element: "root"</li> <li>record element: "entry"</li> <li>id: "@id"</li> <li>name: "@name"</li> <li>data1: "data1"</li> <li>data2: "data1/data2"</li> </ul> <p>and the XSLT would be something like this (the values in "%" are to be replaced by the actual XPath expressions from the above mapping configuration):</p> <pre><code>&lt;xsl:template match="/"&gt; &lt;records&gt; &lt;xsl:apply-templates select="%root element%/%record element%" /&gt; &lt;/records&gt; &lt;/xsl:template&gt; &lt;xsl:template match="%root element%/%record element%"&gt; &lt;record&gt; &lt;id&gt; &lt;xsl:value-of select="%id-xpath%[1]" /&gt; &lt;/id&gt; &lt;name&gt; &lt;xsl:value-of select="%name-xpath%[1]" /&gt; &lt;/name&gt; &lt;!-- and so on --&gt; &lt;/record&gt; &lt;/xsl:template&gt; </code></pre>
    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.
    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