[xsl] xslt sort dilemna

Subject: [xsl] xslt sort dilemna
From: "Mohit Anchlia" <mohitanchlia@xxxxxxxxx>
Date: Tue, 9 Sep 2008 11:10:11 -0700
I have 2 xml that I am merging, something like this:

          <xsl:for-each select="//ret|$file2//ret">
             <xsl:element name="{name()}" namespace="{namespace-uri()}">
              <xsl:apply-templates>
                <xsl:sort select="filing"  order="ascending" data-type="text"/>
                <xsl:sort select="State" order="ascending"  data-type="number"/>
              </xsl:apply-templates>
             </xsl:element>
          </xsl:for-each>


Couple of questions:
1. Above xsl:for-each merges 2 xml documents. Now I want to apply sort
on the merged output. I tried putting sort inside apply-templates as
well as moving inside for-each. It doesn't seem to work. I am trying
to sort on 2 elements. Is there a way I can sort on merged output.

2. Also, when I put sort in for-each it sort only one document at a
time, but second sort on "State" doesn't work.

Current Thread