Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>This transformation</strong>:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt; &lt;xsl:template match="node()|@*"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="node()|@*"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;xsl:template match="entry[@key]"&gt; &lt;xsl:element name="{@key}"&gt; &lt;xsl:apply-templates/&gt; &lt;/xsl:element&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p><strong>when applied on the provided XML document</strong>:</p> <pre><code>&lt;map&gt; &lt;entry key = "status"&gt;ok&lt;/entry&gt; &lt;entry key = "pageNum"&gt;1&lt;/entry&gt; &lt;entry key = "title"&gt;DocTitle&lt;/entry&gt; &lt;entry key = "stuff"&gt; &lt;map&gt; &lt;entry key = "id"&gt;171&lt;/entry&gt; &lt;entry key = "name"&gt;StackOverflow&lt;/entry&gt; &lt;entry key = "timeZone"&gt;America/New_York&lt;/entry&gt; &lt;/map&gt; &lt;map&gt; &lt;entry key = "id"&gt;172&lt;/entry&gt; &lt;entry key = "name"&gt;StackOverflow2&lt;/entry&gt; &lt;entry key = "timeZone"&gt;America/New_York&lt;/entry&gt; &lt;/map&gt; &lt;/entry&gt; &lt;/map&gt; </code></pre> <p><strong>produces the wanted, correct result</strong>:</p> <pre><code>&lt;map&gt; &lt;status&gt;ok&lt;/status&gt; &lt;pageNum&gt;1&lt;/pageNum&gt; &lt;title&gt;DocTitle&lt;/title&gt; &lt;stuff&gt; &lt;map&gt; &lt;id&gt;171&lt;/id&gt; &lt;name&gt;StackOverflow&lt;/name&gt; &lt;timeZone&gt;America/New_York&lt;/timeZone&gt; &lt;/map&gt; &lt;map&gt; &lt;id&gt;172&lt;/id&gt; &lt;name&gt;StackOverflow2&lt;/name&gt; &lt;timeZone&gt;America/New_York&lt;/timeZone&gt; &lt;/map&gt; &lt;/stuff&gt; &lt;/map&gt; </code></pre>
 

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