xsl-list
[Top] [All Lists]

Re: [xsl] Sorting an xml

2006-05-22 08:19:13
----------------------------------------------------------

The printout for this should be sorted by <place> like this:
Kyl och frys:
Lax 8 st
Grädde 1,2 l

Frukt och grönt:
Chalottenlök 4 st

Övrigt:
Matlagningsvin 0,66  l

It would be easier to understand if you give what output xml you are
looking for.

you can try:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <!-- default identity translation -->
        <xsl:template match="*|@*|comment()|processing-instruction()|text()">
                <xsl:copy>
                        <xsl:apply-templates
select="*|@*|comment()|processing-instruction()|text()"/>
                </xsl:copy>
        </xsl:template>
        <!-- start processing with the root element  -->
        <xsl:template match="shopinglist">
                <xsl:copy>
                        <xsl:apply-templates select="item">
                                <xsl:sort select="place"/>
                        </xsl:apply-templates>
                </xsl:copy>
        </xsl:template>
</xsl:stylesheet>

It will reorder the source xml item elements according to the "place"


--

Jagdishwar B.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>