random numbers in xslt ?????


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: random numbers in xslt ?????

  1. #1
    hassan Guest

    random numbers in xslt ?????


    is there a way to generate random numbers in xslt ????

    i have a xml doc and a xslt doc to go with it. it transforms the page into
    an html page. there are 3 nodes that it matches a template for. right now
    the xslt pumps out the html in whatever order the 3 nodes are in the xml
    doc. i want to rearange randomly. can i even do that ?

    if i can't what would be the best approach ?


  2. #2
    Russell Jones Guest

    Re: random numbers in xslt ?????

    Take a look at the XML 10-Minute solution article by Kurt Cagle--he shows
    how to generate randomized data using a little script and XSLT. Here's the
    link. Watch for linebreaks.
    http://gethelp.devx.com/techtips/xml...kc031501-1.asp

    You should also look at the count() function. Unless there are always three
    nodes, you'll need the count function to count the number of nodes to
    randomize. Given an index number (from a random function) you can select the
    nodes in any order you want using XPath queries in your XSLT template.


    "hassan" <mirzahassa@hotmail.com> wrote in message
    news:3aedde55$1@news.devx.com...
    >
    > is there a way to generate random numbers in xslt ????
    >
    > i have a xml doc and a xslt doc to go with it. it transforms the page into
    > an html page. there are 3 nodes that it matches a template for. right now
    > the xslt pumps out the html in whatever order the 3 nodes are in the xml
    > doc. i want to rearange randomly. can i even do that ?
    >
    > if i can't what would be the best approach ?
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center