Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9111749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:34:46+00:00 2026-06-17T03:34:46+00:00

I have a HTML select dropdown: <select name=sortby> <option value=></option> <option value=onenightavg>Price: High to

  • 0

I have a HTML select dropdown:

                <select name="sortby">
                    <option value=""></option>
                    <option value="onenightavg">Price: High to Low</option>
                    <option value="number_bedrooms">Bedrooms: High to Low</option>
                    <option value="number_bathrooms">Bathrooms: High to Low</option>
                    <option value="max_sleeps">Sleeps: High to Low</option>
                </select>

When the user submits this it sends a URL query string to the page and it gets added to the XML of the page:

<querystring>
 <sortby>number_bathrooms</sortby>
</querystring>

I then set an XSL variable in my XSLT:

        <xsl:variable name="sortby">
            <xsl:choose>
                <xsl:when test="/querystring/sortby != ''">
                    <xsl:value-of select="/querystring/sortby" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="'onenightavg'" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

In the above XST I am setting a variable called $sortby and testing whether the querystring exists. If it does exist then set the variable to its value. If it doesn’t exist then default it to “onenightavg”.

Then I use that variable in my sort:

<xsl:sort data-type="number" order="ascending" select="$sortby" />

This doesn’t work. It doesn’t sort my items, but when I hardcode the select to any one of the values like this it works:

<xsl:sort data-type="number" order="ascending" select="onenightavg" />

I would like to be able to dynamically sort based on an the value of the selected option in the dropdown.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T03:34:47+00:00Added an answer on June 17, 2026 at 3:34 am

    How about this:

    <xsl:sort data-type="number" order="ascending" select="*[local-name() = $sortby]" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if i have a dropdown with the following html: <select id=myDropdown name=myDropdown> <option value=6>Six</option>
I have an html dropdown : <select name=name1> <option value=1>John</option> <option value=2>Doe</option> <option value=3>Foo</option>
I have a classic HTML select box: Show: <select name=show id=showThreads> <option value=all selected=selected>All</option>
I have this html on a web page: <select name=chapter_select class=chapter_select> <option value=http://www.example.com/chapter/1>Chapter 1</option>
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
I have a html select list menu,when user select an option he/she is redirected
I have a select html tag, and I want the background-color of the option
I have 3 dropdown lists. 1) Type 2) Duration 3) Class <select name=passenger_type_of_pass class=pass>
I have a multiselect dropdown inside a table <td> <select multiple=multiple name=multiple id=multiple class=required>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.