Jump to content

Need help with XML


Shadow Wolf

Recommended Posts

I am learning to work with XML and have been working to apply a couple tutorials with the xml file that I am attempting to work with.

 

The xml I am working with:

http://www.animeregister.com/roster.xml

 

I've figured out how to pull the data out that I want and modify the format with a XSL that I have here:

http://www.animeregister.com/roster.xsl

 

Now I'm trying to figure out a way to sort through the data, so a user can choose to sort it. I make manual sort by using:

<xsl:sort select="@name/>

 

I can change it to ascending, descending and choose level instead of name if I wanted. But I have to make those changes.

 

Is there a way to add multiple sort options? So if they click on Name, it would then ascending sort by name. Clicking on name again, it is now sorted descending by name. If they click on rating it would sort descending by rating, if they click on that again then it would sort ascending and so forth?

 

From looking at some tutorials it looks like I can use a "xsl:when" and "xsl:otherwise" command to display or create my two different order options descending and ascending. But I still can't figure out how to I translate that into a clickable link on X item to change the sort.

Link to comment
https://forums.phpfreaks.com/topic/87926-need-help-with-xml/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.