Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML problem

Status
Not open for further replies.

bieltan

Programmer
Oct 14, 2005
1
US
Im relitivly new to the XML and have been self teaching. I've heard that you can sort xml records by an 'onclick' method. What im looking to do is a simple sort by pressing a button on a page and have the records sorted. Sorted as in if i have Records X, X, Y, Z. I press button "Sort X" only X and X will be show in my HTML Table.

Any good resources to find an example of this to learn from?
 
you can use a for each loop to loop through the data set and then sort the result.


heres how to sort
<xsl:sort select="your data here" data-type="number"/>

some javascript might help. you could use a function inside the href which calls a for-each loop that sorts

hope this helps
 
I think you're a bit confused here. XML is just a structured data storage format. 'Onclick' is an HTML attribute that will call a javascript function.

Are you using XML at the moment or do you just have an HTML page?

The usual way to use XML for HTML is:

XML > XSL > HTML

Then any client-side interaction is normally done with javascript. You could use a server-side language (or indeed javascript) to pass a parameter to the XSL stylesheet that would filter the sort, but you best choice would probably be javascript.

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top