My XML looks a bit like this:<BR><phonebook><BR> <phone id=123 name="Simon" telno="55555"/><BR> <phone id=123 name="Simon" telno="22222"/><BR></phonebook><BR><BR>But I only want to display the name in a list once, but with both tel no's.<BR><BR>I have a loop which goes around each "record" and then a loop within that to display each tel no that user has.<BR><BR>However, when it displays the next line, it displays the same name again because it occurs again.<BR><BR>I wanted to have a variable which would allow it to remember the current person id then not do any action on it for the next time round if it was the same.<BR>
.. are not very pleasant in XSL, at all.<BR><BR>But, it CAN be done (I know because I did it).<BR><BR>You are basically looking at using the Axes.<BR><BR>I'll see if I can find the CD because the syntax was way wacked. But, do some research on XSL Axes.
Would it be easier if I set up my XML as:<BR><BR><?xml version="1.0"?><BR><?xml version="1.0"?> <BR><?xml-stylesheet type="text/xsl" href="phonelist.xsl"?> <BR><phonelist> <BR><phone><BR> <personid>20000</personid><BR> <title>Dr</title><BR> <firstname>John</firstname><BR> <telno>2311</telno><BR> <telno>1266</telno><BR></phone><BR></phonelist> <BR>
.. your "root" is relative to the template.<BR><BR>See how you did ./surname and even <xsl:value-of select="surname" /> -- that means, you have already assumed your root is "phonelist/phone".<BR><BR>So, the for-each should be:<BR><xsl:for-each select="./[./surname='Harvey']"><BR><BR>But, you know you can filter this on the way in...<BR><xsl:apply-templates select="phonelist/phone['./surname='Harvey']"><BR><BR><xsl:template match="phonelist/phone"><BR><tr>...</tr><BR></xsl:template><BR><BR>It'll show all matches that have a surname of "Harvey". It's really cool and pretty powerful.