title: How to sort in XSLT for each element when all elements are siblings
body: <p>I have below XML and I want to sort on basis on City.</p>
  
  <pre><code>  &lt;catalog&gt;
     &lt;cd&gt;
        &lt;City&gt;New York&lt;/City&gt;
        &lt;City&gt;Mumbai&lt;/City&gt;
        &lt;City&gt;Kolkata&lt;/City&gt;
        &lt;City&gt;Paris&lt;/City&gt;
        &lt;City&gt;London&lt;/City&gt;
        &lt;City&gt;Sydney&lt;/City&gt;
        &lt;City&gt;California&lt;/City&gt;
        &lt;City&gt;Vizag&lt;/City&gt;
        &lt;City&gt;Uganda&lt;/City&gt;
     &lt;/cd&gt;
  &lt;/catalog&gt;
  </code></pre>
  
  <p>I tried below XSLT to sort but it is considering only first City element and giving only one City but I want all City in sorted manner(ascending/descending).</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  
  &lt;xsl:template match="/"&gt;
    &lt;html&gt;
    &lt;body&gt;
      &lt;h2&gt;My CD Collection&lt;/h2&gt;
      &lt;table border="1"&gt;
        &lt;tr bgcolor="#9acd32"&gt;
          &lt;th&gt;City&lt;/th&gt;
        &lt;/tr&gt;
        &lt;xsl:for-each select="catalog/cd"&gt;
        &lt;xsl:sort select="City"/&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;xsl:value-of select="City"/&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;/xsl:for-each&gt;
      &lt;/table&gt;
    &lt;/body&gt;
    &lt;/html&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Thanks in advance!!!</p>