[xsl] How to create hyperlinks using XSL or XML files

Subject: [xsl] How to create hyperlinks using XSL or XML files
From: "Stephanie M. Watson" <Stephanie_M._Watson@xxxxxxxxxxxxxx>
Date: Thu, 12 Dec 2002 14:44:43 -0500
Hello All:

I apologize if this is a repetitive question, but I browsed the archives and couldn't find quite what I was looking for. I am new to XML and need some help. 

I have an XML file which is a listing of different scientific resources on the web.  The beginning of the file and two entries of scientific resources in it looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE Digital_Catalog SYSTEM "digital_catalog_sw.dtd">
<?xml-stylesheet type="text/xsl" href="bdeicatalogwimage.xslt"?>

<Digital_Catalog>
	<Content>
		<Environmental>
			<Environmental_Title>Environmental Data</Environmental_Title>
			<Environmental_Data 
Site_Type_Title="Website Type:" 
Site_Type="Data" 
Subject_Type_Title="Subject:" 
Subject_Type="Biological">
<Website Site_Title="Website Title:" 
Website_Title="USFWS Gulf of Maine Program" 
Web_address="URL:" 
URL="http://gulfofmaine.fws.gov/"; 
Site_Description="Description:" 
Description="This site offers access to habitat information for the Gulf of Maine watershed." 
Temporal="Temporal Coverage:" 
Temporal_Coverage="Unlimited" 
Spatial="Spatial Coverage:" 
Spatial_Coverage="Gulf of Maine" 
Variables="Variables:" 
Variable1="Habitat" 
Monitoring="Monitoring Frequency:" 
Monitoring_Frequency="Varies"/>
		</Environmental_Data>
		<Environmental_Data 
Site_Type_Title="Website Type:" 
Site_Type="Data" 
Subject_Type_Title="Subject:" 
Subject_Type="Biological">
<Website Site_Title="Website Title:" 
Website_Title="Pilot Census of Marine Life for the Gulf of Maine" Web_address="URL:" 
URL="http://www.whoi.edu/marinecensus/index.htm"; 
...
		</Environmental_Data>
	
I want to display the URLs that I have declared in the XML document as URL="http://..."; as hyperlinks on the web.  Currently, the output from my stylesheet looks like this in Internet Explorer:

Website Type:
Data
Subject:
Biological
Website Title:
USFWS Gulf of Maine Program
URL:
http://gulfofmaine.fws.gov/
Description:
This site offers access to habitat information for the Gulf of Maine watershed. 
Temporal Coverage:
Unlimited
Spatial Coverage:
Gulf of Maine
Variables:
Habitat
Monitoring Frequency:
Varies
[whole thing repeats for each different website]

I'm thinking that I have to work with the XSL file, but so far, I only see a way to hyperlink a single URL in the stylesheet  -- so that the one hyperlinked URL is used in every listing in the XML document.  

Here's the relevant part of my XSLT file  (the URL section).  This simply displays the web address when the XML file is viewed on IE.  The address is not an active hyperlink.  

<xsl:for-each select="@URL">
<span style="font-family:Arial">
<xsl:value-of select=""/>
</span>
</xsl:for-each>

Any ideas on how to resolve this are greatly appreciated. 

Thank you.

Stephanie Watson
Unversity of Maine




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


Current Thread