RE: [xsl] Using a URL in a XSL doc

Subject: RE: [xsl] Using a URL in a XSL doc
From: Duncan Lock <duncan.lock@xxxxxxxxxxxxxxxx>
Date: Tue, 10 Apr 2001 14:02:44 +0100
Hi,
	Try these. Modified versions of the ones you posted.

start .XML file:
--------------------8<----------------------------------

<?xml version="1.0"?>
<?xml:stylesheet rel="stylesheet" type="text/xsl" href="test.xslt" ?>

<programs>
	<program>
		<title>The Life and Adventures of Nicholas Nickleby</title>
		<priority>1</priority>
	
<article_url>http://www.mysite.com/mustwatch/article/1/1,7343,e38584,00.html
</article_url>
		<channel>Sky One</channel>
		<time>9:00pm</time>
		<image>1_files/generic_article.jpg</image>
	</program>
</programs>

--------------------8<----------------------------------
end .XML file:

start .XSLT file (wide, may get wrapped, I suggest you unwrap it):
--------------------8<----------------------------------

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
	<xsl:template match="/">
		<html>
		<body>
			<table height="280" cellSpacing="0" cellPadding="0"
width="612" border="0">
				<tbody>
					<tr>
						 <td rowSpan="8"><spacer
width="7" height="285" type="block"/></td>
						 <td align="left"
colSpan="4"><spacer width="23" height="5" type="block"/></td>
					</tr>

					<tr>
							<td><img alt=""
src="1_files/mustwatch_leftarrow.gif" border="0"/></td>
							<td align="left"
colSpan="2"><font color="#400328" size="5">unmissable </font></td>
							<td
align="right"><font color="#280219" size="4">page 1 of 3</font></td>
					</tr>

					<xsl:apply-templates
select="programs/program"/>


				</tbody>
			</table>
		</body>
		</html>
	</xsl:template>

	<xsl:template match="program">
		<tr>
			<td><spacer width="23" height="1"
type="block"/></td>
				<td colspan="3" height="23">
					<a>
						<xsl:attribute
name="href"><xsl:value-of select="article_url"/></xsl:attribute>
						<xsl:apply-templates
select="title"/>
					</a>
				</td>
		</tr>
	</xsl:template>
</xsl:stylesheet>
--------------------8<----------------------------------
end .XLST file.

Hope this helps. I works OK in ie5.5 + msxml3.0 and ought to be okay
generally. I'm not sure if the <xsl:attrbute> stuff
I've put in is 100% standards compliant or not but this (or something like
it) would be the way to do it.

Dunc.

> -----Original Message-----
> From: Phillip Vamplew [mailto:Phillip@xxxxxxxxxxx]
> Sent: 10 April 2001 2:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Using a URL in a XSL doc
> 
> 
> I am a new xsl developer, I wander if anyone out there can 
> help with my
> simple problem.
> 

> -----Original Message-----
> From: Phillip Vamplew [mailto:Phillip@xxxxxxxxxxx]
> Sent: 10 April 2001 2:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Using a URL in a XSL doc
> 
> 
> I am a new xsl developer, I wander if anyone out there can 
> help with my
> simple problem.

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


Current Thread