[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Comparing values in a 2nd XML document

Subject: Comparing values in a 2nd XML document
From: JOHN MARSHALL <marshall.john@xxxxxxxxxx>
Date: Wed, 26 Nov 2003 10:39:24 +1100
xml progid
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 [expletive deleted] 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.john@xxxxxxxxxx



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.