Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>This XSLT 1.0 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:strip-space elements="*"/&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="fields"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@*"/&gt; &lt;xsl:apply-templates&gt; &lt;xsl:sort select="@position" data-type="number"/&gt; &lt;/xsl:apply-templates&gt; &lt;/xsl:copy&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;fields&gt; &lt;field position="4" tablename="Students" headername="First Name" fieldreference="FirstName" orderbydirection="ASC" /&gt; &lt;field position="2" tablename="Students" headername="Last Name" fieldreference="LastName" orderbydirection="ASC" /&gt; &lt;field position="3" tablename="Students" headername="Race" fieldreference="Race" orderbydirection="ASC" /&gt; &lt;field position="1" tablename="Students" headername="Sex" fieldreference="Sex" orderbydirection="ASC" /&gt; &lt;field position="5" tablename="Students" headername="State" fieldreference="State" orderbydirection="ASC" /&gt; &lt;/fields&gt; </code></pre> <p><strong>produces the wanted result</strong>:</p> <pre><code>&lt;fields&gt; &lt;field position="1" tablename="Students" headername="Sex" fieldreference="Sex" orderbydirection="ASC" /&gt; &lt;field position="2" tablename="Students" headername="Last Name" fieldreference="LastName" orderbydirection="ASC" /&gt; &lt;field position="3" tablename="Students" headername="Race" fieldreference="Race" orderbydirection="ASC" /&gt; &lt;field position="4" tablename="Students" headername="First Name" fieldreference="FirstName" orderbydirection="ASC" /&gt; &lt;field position="5" tablename="Students" headername="State" fieldreference="State" orderbydirection="ASC" /&gt; &lt;/fields&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. This table or related slice is empty.
    1. 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