Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The first part of this is performing the transformation in javascript:</p> <pre><code>function transformXML(_xml, _xsl) { var xml = typeof _xml == 'string' ? new DOMParser().parseFromString(_xml, 'text/xml') : _xml // assume this is a node already ,xsl = typeof _xsl == 'string' ? new DOMParser().parseFromString(_xsl, 'text/xml') : _xsl // assume this is a node already ,processor = new XSLTProcessor() ; processor.importStylesheet(xsl); return processor.transformToDocument(xml.firstChild); } </code></pre> <p>This function accepts two params. The first is the xml that you want to transform. The second is the xslt that you want to use to transform the xml. Both params accept either strings that will be transformed to nodes or nodes themselves (such as XHR.responseXML).</p> <p>The second part of the puzzle is sorting which you will use xsl's built-in <code>xsl:sort</code>.</p> <pre><code>&lt;xsl:sort select="expression" lang="language-code" data-type="text|number|qname" order="ascending|descending" case-order="upper-first|lower-first"/&gt; </code></pre> <p>All parameters are optional besides the select statement.</p> <p><strong>Sample sort usage:</strong></p> <pre><code>&lt;xsl:for-each select="catalog/cd"&gt; &lt;xsl:sort select="artist"/&gt; &lt;xsl:value-of select="artist"/&gt; &lt;xsl:text&gt; - &lt;/xsl:text&gt; &lt;xsl:value-of select="title"/&gt; &lt;/xsl:for-each&gt; </code></pre> <p>You can find more information about <code>xsl:sort</code> at <a href="http://www.w3schools.com/xsl/el_sort.asp" rel="nofollow noreferrer">w3schools</a>.</p>
    singulars
    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.
    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