lclqt12 Posted November 23, 2010 Posted November 23, 2010 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 ?
boen_robot Posted November 23, 2010 Posted November 23, 2010 A for-each in a for-each?What exactly are you having trouble with? What have you attempted?
lclqt12 Posted November 24, 2010 Author Posted November 24, 2010 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.