How do I sort by [rank] and display [name] with [xsl]?

Discussion in 'XML' started by volunteer@spatiallink.org, May 31, 2006.

  1. Guest

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="filename.xsl"?>
    <markers date="20060523">
    04:21:50 PM
    <marker sn="1" rank="6" name="john" />
    <marker sn="2" rank="5" name="mary" />
    <marker sn="3" rank="4" name=suzy" />
    </markers>

    How do I sort by [rank] and display [name] using [xsl] etc- some help
    with drill-down?
    Thanks, Lorrie

    [reference]:
    http://groups.google.com/group/comp...IeT1EDOM2mW4U1ahHovJa5cimornVOgAGdfrh31zskQ7Q
    http://groups.google.com/group/comp...5e45baaff2c14d?q=sort&rnum=1#0a5e45baaff2c14d
     
    , May 31, 2006
    #1
    1. Advertising

  2. Joris Gillis Guest

    On Wed, 31 May 2006 17:13:27 +0200, <> wrote:

    > <?xml version="1.0" encoding="UTF-8"?>
    > <?xml-stylesheet type="text/xsl" href="filename.xsl"?>
    > <markers date="20060523">
    > 04:21:50 PM
    > <marker sn="1" rank="6" name="john" />
    > <marker sn="2" rank="5" name="mary" />
    > <marker sn="3" rank="4" name=suzy" />
    > </markers>
    >
    > How do I sort by [rank] and display [name] using [xsl] etc- some help
    > with drill-down?



    I guess the best way to learn is to learn by example:

    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:eek:utput method="xml" indent="yes"/>

    <xsl:template match="markers">
    <table>
    <caption>markers</caption>
    <tr>
    <th>name</th>
    <th>rank</th>
    </tr>
    <xsl:apply-templates select="marker">
    <xsl:sort select="@rank" data-type="number" order="ascending"/>
    </xsl:apply-templates>
    </table>
    </xsl:template>

    <xsl:template match="marker">
    <tr>
    <td><xsl:value-of select="@name"/></td>
    <td><xsl:value-of select="@rank"/></td>
    </tr>
    </xsl:template>

    </xsl:stylesheet>

    regards,
    --
    Joris Gillis (http://users.telenet.be/root-jg/me.html)
    Veni, vidi, wiki (http://www.wikipedia.org)
     
    Joris Gillis, Jun 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nobody
    Replies:
    0
    Views:
    559
    nobody
    Jun 1, 2004
  2. Replies:
    1
    Views:
    3,656
    A. Bolmarcich
    May 27, 2005
  3. Replies:
    2
    Views:
    9,330
    Martin Honnen
    Sep 5, 2006
  4. j0mbolar

    rank and expressions

    j0mbolar, Jul 30, 2004, in forum: C Programming
    Replies:
    3
    Views:
    283
    Eric Sosman
    Jul 30, 2004
  5. Navin
    Replies:
    1
    Views:
    749
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page