Jump to content

Problem with <xsl:for-each> result


lclqt12

Recommended Posts

Hi all,I have a xml file :<root> <person> <name>Person A</name> <company> <Cname>Company A1</Cname> <Year>1</Year> <Position>developer</Position> </company> <company> <Cname>Company A2</Cname> <Year>2</Year> <Position>developer2</Position> </company> </person> <person> <name>Person B</name> <company> <Cname>Company B</Cname> <Year>1</Year> <Position>developer</Position> </company> </person></root>if i want to display like : -----------------------------------Name : Person ACompany :Company A1, Year 1, DeveloperCompany A2, Year 2, Developer 2-----------------------------------Name : Person BCompany :Company B, Year 1, DeveloperHow could i use <xsl:for-each> statement in this situation ?

Link to comment
Share on other sites

A for-each in a for-each?What exactly are you having trouble with? What have you attempted?

Link to comment
Share on other sites

A for-each in a for-each?What exactly are you having trouble with? What have you attempted?
Thank you for your reply, i used
<xsl-foreach select="/root/person/">  <xsl-foreach select="/root/person/company>	 ........   </xsl-foreach></xsl-foreach>

and the data was displayed wrongly. I've changed : "/root/person/company" to "company" and it works fine.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...