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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying list by part of XML in list

Status
Not open for further replies.

Craftor

Programmer
Feb 1, 2001
420
NZ
I'm sure that sounded a bit confusing :-(

Basically what I have is the following:

<data>
<name>Joe Bloggs</name>
<building>Big Center</building>
<tel>111-1111</tel>
<name>Ted Bloggs</name>
<building>Big Center</building>
<tel>222-1111</tel>
<name>Bill Bloggs</name>
<building>Small Center</building>
<tel>333-1111</tel>
</data>

And I want to display as follows:

BIG CENTER
Joe Bloggs 111-1111
Ted Bloggs 222-1111

SMALL CENTER
Bill Bloggs 333-1111

Can anyone please help me to do this with XSLT as I have no idea whatsoever [cry]

Thanks as always

Craftor
:cool:
 
Craftor, your data is not hierarchal so i would not even try to do it. If you can get the data to look something like below then it would be simple to attain your goal
Code:
<data>
	<building name=&quot;Big Center&quot;>
		<person>
		  <name>Joe Bloggs</name>
		  <tel>111-1111</tel>
		</person>
		<person>
		   <name>Ted Bloggs</name>
		   <tel>222-1111</tel>   
		</person>
	</building>
   <building id=&quot;Small Center&quot;>
		<person>
			<name>Bill Bloggs</name>
			<tel>333-1111</tel>
		<person>
	</building>   
</data>

-pete
 
Hi Pete

I agree - that's probably the best way to do it. Wanted to try and keep my structure tho :-(

Thanks for your help as always

Craftor
:cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top