I have a webpage that uses an XML file for the PHP input. This XML file contains information on written pieces featured on my website.
Below is a sample of said XML:
What the PHP does is for each <Category> element, grabs a list of all <Work> elements therein. Here is the sorting I desire: To sort the <Work> elements alphabetically by the contents of their respective full attributes, regardless of their respective <SubCategory> elements (which come into play in other pages).HTML Code:<Category name="Essays"> <Preamble> <Par>I like to think of myself as a social commentator. Of course, anyone is free to tell me where to stick my opinion, but I've got an opinion, and I'm sticking to it. :)</Par> <Par>Here are the essays I have written, either for class, personal ponderance, or for publication in my college newsletter. Enjoy.</Par> </Preamble> <SubCategory sname="Articles" lname="Newspaper and Newsletter Articles"> <SubCatDesc> <Par>I've written articles for various newsletters over the years. However, there is a challenge in posting them here. Not only must I get permission for some of them, but finding copies of the articles themselves can be just as difficult.</Par> </SubCatDesc> <Works> <Work short="csi" full="CS&#34;I Have No Idea What I'm Talking About&#34;" rating="pg"> <Par>The truth behind the CSI Episode (written for The Source the Devry Calgary newsletter). I have since watched the episode.</Par> </Work> </Works> </SubCategory> <SubCategory sname="Politics" lname="Political Essays"> <SubCatDesc> <Par>Politics is important to me. I'm a supporter of constitutional monarchies, but a strong believer in Democracy. I believe that while political tradition is important, the people should have the final say&mdash;and know what they're saying!</Par> </SubCatDesc> <Works> <Work short="democracy" full="Demands of Democracy" rating="pg"> <Par>What democracy needs to survive.</Par> </Work> <Work short="responsibilityprerogative" full="Responsibility, Not Prerogative" rating="14"> <Par>This is an essay I sweated, cried, cursed, and trembled over, since it was for school. My terror that I'd get a 0 on it were unfounded, I actually got 98% on it. Feeling rather proud of my accomplishment, I put this essay here. Warning: it's one of the longest essays I've ever written.</Par> </Work> </Works> </SubCategory> <SubCategory sname="Websites" lname="On Website Design"> <SubCatDesc> <Par>As you know, I'm a website designer. Some of what I write is based on what I enjoy doing.</Par> </SubCatDesc> <Works> <Work short="accessible" full="Accessible Websites" rating="g"> <Par>Coding for maximum accessibility is easier than one might think.</Par> </Work> </Works> </SubCategory> <SubCategory sname="Writing" lname="Essays on Writing"> <SubCatDesc> <Par>As an author, I have written some things on writing itself.</Par> </SubCatDesc> <Works> <Work short="fanficetequette" full="When Art Inspires a Story" rating="g"> <Par>So you wish to write a fanfic? There are a few points of etiquette you should follow.</Par> </Work> <Work short="rpingandwriting" full="Roleplaying and Writing" rating="g"> <Par>An essay on the link between good roleplaying and good fiction.</Par> </Work> </Works> </SubCategory> </Category>


Reply With Quote
Bookmarks