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!

Arranging tables in XSLT

Status
Not open for further replies.

GavinP1983

Programmer
Aug 31, 2005
6
GB
Hi

I've a list of names and associated details, for example:

<name>Gav</name>
<home>UK</home>
<age>16</age>

<name>Brian</name>
<home>UK</home>
<age>22</age>

<name>Sarah</name>
<home>USA</home>
<age>55</age>

I'm new to this so please bear with me. Using a for-each loop, I can iterate through the list and print it out by <home> (for example, Gavin and Brian would come before Sarah) but I'd like to create a table and list Brian and Gavin in it by their country. Sarah would be in a separate table with anyone else from the USA.

Could anyone give me an idea of how to do this?
 
You need to use grouping:


One method is to use xpath to see which nodes have no previous siblings that are the same (can be slow if large XML). The other way is to use keys.

Try that link, if you get stuck, gimme a shout.

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