I'm having difficulty running a test and selecting a value from a second XML
document.
I have one XML document, pad_output.xml which includes what on air this week.
I also have prog.xml which includes all the shows and their associated ID's.
There is a web page based on these ID.
prog.xml looks like this...
<programs>
<program>
<progID>7</progID>
<progName>The Adventures of Sam</progName>
</program>
<program>
<progID>8</progID>
<progName>The Adventures of Spot</progName>
</program>
...
</programs>
At the moment, I'm sucking out all the shows that are on air, and putting them
in my html page.
But I want to include links to the relevant pages from the prog.xml document.
So I'm selecting the pad_long_title_1 from a document called pad_output.xml
Now I want to compare the value of pad_long_title_1 to the value of progName in
the second XML document prog.xml
When I find a match between pad_long_title_1 and progName, I want to select the
value of progID and do something like
<xsl:element name="a">
<xsl:attribute
name="href">/rollercoaster/kidstv/shows/prog<xsl:value-of select="progID"
/>.htm</xsl:attribute>
<xsl:value-of select="pad_long_title_1" />
</xsl:element>
So I'll end up with
<a href="/rollercoaster/kidstv/shows/prog7.htm">The Adventures of Sam</a>
<a href="/rollercoaster/kidstv/shows/prog8.htm">The Adventures of Spot</a>
but I keep getting the same and first value of the document. Eg I'm getting
<a href="/rollercoaster/kidstv/shows/prog1.htm">The Adventures of Sam</a>
<a href="/rollercoaster/kidstv/shows/prog1.htm">The Adventures of Spot</a>
<xsl:variable name="isProgNamePAD" select="pad_long_title_1" />
<xsl:variable name="isProgNamePROG" select="$pp//progName" />
<xsl:variable name="ppID" select="$param4"/>
<xsl:variable name="testPassed">
<xsl:choose>
<xsl:when test="$isProgNamePROG =
$isProgNamePAD">
<xsl:param name="param4"
select="$pp//progID"/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<p>Prog ID
<xsl:value-of select="$pp//progID"/>
<br />
<xsl:element name="a">
<xsl:attribute
name="href">/rollercoaster/kidstv/shows/prog<xsl:value-of select="$ppID"
/>.htm</xsl:attribute>
<xsl:value-of select="pad_long_title_1" />
</xsl:element>
</p>
I thought I could do this (pseudo code)
<xsl:value-of select="pad_long_title_1" />
set variable title = pad_long_title_1
loop element in prog.xml
if pad_long_title_1 = prog//progName
set variable ID = progID
exit
<xsl:attribute name="href">/rollercoaster/kidstv/shows/prog<xsl:value-of
select="ID" />.htm</xsl:attribute>
<xsl:value-of select="pad_long_title_1" />
John Marshall - Web Developer
mailto:marshall(_dot_)john(_at_)abc(_dot_)net(_dot_)au
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list