I currently have an XML document which basically consists of several conversations between people just like an IM conversation.
I have each conversation displaying how I want to so far, except I want each name to be a unique color for readability.
How I have it is that the XML is transformed into HTML with CSS. I'd like to use XPath and XSL 1.0 for this:
XML
<wtfwhispers xmlns="http://wtfwhispers.kicks-ass.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://wtfwhispers.kicks-ass.org wtfwhispers.xsd">
<conversation uuid="Diedrick">
<datePosted>2010-05-30</datePosted>
<description>What a great description</description>
<dialog>
<dialogDate>2009-12-22</dialogDate>
<whisper>
<whisperTime>03:55:00</whisperTime>
<speaker>Stubbymush</speaker>
<babble>i said something here</babble>
</whisper>
<whisper>
<whisperTime>03:56:00</whisperTime>
<speaker>Jaymes</speaker>
<babble>what did you say?</babble>
</whisper>
<whisper>
<whisperTime>03:56:00</whisperTime>
<speaker>Stubbymush</speaker>
<babble>i said something here!</babble>
</whisper>
...
<whisper>
<whisperTime>03:57:00</whisperTime>
<speaker>Stubbymush</speaker>
<babble>gawd ur dumb</babble>
</whisper>
</dialog>
</conversation>
</wtfwhispers>
Ideally what I would want is to get an output of <p class="speaker one">
for the first speaker, <p class="speaker two">
for the 2nd and so on.
I was trying to use and the Meunchian Method to find how many unique speakers I have but what I have was not working:
...
<xsl:key name="speakerList" match="wtf:whisper" use="wtf:speaker" />
<xsl:template match="/">
<html lang="en">
<body>
<p>
<xsl:value-of select="count( key( 'speakerList', wtf:speaker ) )" />
</p>
</body>
</html>
</xsl:template>
...
When I input 'Jaymes' or 'Stubbymush' I'd get the correct number of times that speaker spoke, but not how many speakers were in the conversation total.
Thanks in advance and if you have any suggestions for simpler methods because I'm overcomplicating it please advise.