Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. sorting

sorting

Scheduled Pinned Locked Moved XML / XSL
xmlalgorithmsquestion
4 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sonu Kapoor
    wrote on last edited by
    #1

    Hey Guys, I am using ASP to load some data from a xml file via xsl. Now i need to sort this data, i know i could use the xsl:sort element but i need a dynamic one, which the user can change. So the user will have the possibilty to sort the data in different ways. I already tried to pass a param to xsl and put it to but it didnt worked. Isnt it possible to pass a sort statement in selectnodes ? Is there any such function ? Any suggestions ?? thanks Sonu da sonu :cool:

    R L 2 Replies Last reply
    0
    • S Sonu Kapoor

      Hey Guys, I am using ASP to load some data from a xml file via xsl. Now i need to sort this data, i know i could use the xsl:sort element but i need a dynamic one, which the user can change. So the user will have the possibilty to sort the data in different ways. I already tried to pass a param to xsl and put it to but it didnt worked. Isnt it possible to pass a sort statement in selectnodes ? Is there any such function ? Any suggestions ?? thanks Sonu da sonu :cool:

      R Offline
      R Offline
      Ranjan Banerji
      wrote on last edited by
      #2

      If you are using DOM then try the following. Based on the user's selections create an XSL with the appropriate sort and then apply it to your XML using the DOMDoc object.

      S 1 Reply Last reply
      0
      • R Ranjan Banerji

        If you are using DOM then try the following. Based on the user's selections create an XSL with the appropriate sort and then apply it to your XML using the DOMDoc object.

        S Offline
        S Offline
        Sonu Kapoor
        wrote on last edited by
        #3

        I am using DOM, but i am not very familiar with that. Do you have any example code which might help me ? da sonu :cool:

        1 Reply Last reply
        0
        • S Sonu Kapoor

          Hey Guys, I am using ASP to load some data from a xml file via xsl. Now i need to sort this data, i know i could use the xsl:sort element but i need a dynamic one, which the user can change. So the user will have the possibilty to sort the data in different ways. I already tried to pass a param to xsl and put it to but it didnt worked. Isnt it possible to pass a sort statement in selectnodes ? Is there any such function ? Any suggestions ?? thanks Sonu da sonu :cool:

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi,
          try to put this code:
          <xsl:sort order="ascending" data-type="text" select="//records/*[name() = $OrderField]"/>
          Where the parameter $OrderField contains the name of the field to order.
          Pau

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups