xsl-list
[Top] [All Lists]

[xsl] sibling sorting

2018-05-31 07:41:17
Dear All,

Here is my XML:
               <descriptor>
                  <mainterm weight="a">dexmedetomidine</mainterm>
                  <link>zdverse drug reaction - disease</link>
                  <sublink>xerostomia</sublink>
                  <sublink>nausea</sublink>
                  <link>drug therapy</link>
                  <sublink>respiration depression</sublink>
                </descriptor>

The required output is:

               <descriptor>
                  <mainterm weight="a">dexmedetomidine</mainterm>
                  <link>drug therapy</link>
                  <sublink>respiration depression</sublink>
                  <link>zdverse drug reaction - disease</link>
                  <sublink>nausea</sublink>
                  <sublink>xerostomia</sublink>
                </descriptor>

My XSLT:

    <xsl:template match="ani:descriptor">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates>
                <xsl:sort select="ani:link|ani:sublink" order="ascending"
data-type="text"/>
            </xsl:apply-templates>
        </xsl:copy>
    </xsl:template>

In the XML both the link and sublink elements are sibling to each other,
first links have to sorted then sublink. With the above XSLT i am getting
the output same as input. Help in this regard is appreciated.

Regards,
Ganesh
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>