473,770 Members | 6,952 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with XLink and XSL documents

1 New Member
I have an XML and XSL document. I am trying to incorporate hyperlinks throughout the XML document. I have read many of the related posts on this and other forums but I can't seem to get it right. Please help! Do I have to declare the namespace in the XSL doc also as shown below or should I take it out? No matter what I do, nothing appears for the link tag in the browser.

a piece of my xml DOC (using google for now as an easy example but google will not be my actual webpage):

[html]<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="genre.xsl "?>

<movielist>
<intro>Browse the Foreign Movies</intro>

<movie language="spani sh" country="mexico " genre="drama">
<title>Y Tu Mamá También</title>
<date>2002</date>
<country>Mexico </country>
<language>Spani sh</language>
<rating>R</rating>
<director>Alfon so Cuarón</director>
<actors>Ana López Mercado, Gael García Bernal, Diego Luna</actors>
<genre>Drama</genre>
<summary>In Mexico, two teenage boys and an attractive older woman embark on a road trip and learn a thing or
two about life, friendship, and each other.</summary>
<link> xmlns:xlink="ht tp://www.w3.org/1999/xlink/"
xlink:type="sim ple" xlink:href="htt p://www.google.com"
xlink:title="Go ogle" xlink:role=""ht tp://www.w3.org/1999/XSL/Transform">
xlink:actuate=" onRequest"
</link>
</movie>[/html]


xsl document in whole:
[html]<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:styleshe et version="1.0" xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:xlink="ht tp://www.w3.org/1999/xlink" exclude-result-prefixes="xlink ">


<xsl:key name="genre" match="movie" use="@genre" />
<xsl:template match="/movielist">
<html>
<head>
<title>Movies By Genre</title>
</head>
<body>
<H1><xsl:appl y-templates select="intro"/></H1>
<H1>By Genre</H1>

<a href="genre.xml #t1">Action</a>
<br></br>
<a href="genre.xml #t2">Animation </a>
<br></br>
<a href="genre.xml #t3">Comedy</a>
<br></br>
<a href="genre.xml #t4">Drama</a>
<br></br>
<a href="genre.xml #t5">Suspense</a>

<a name="t1"><H1>A ction Movies</H1></a>
<xsl:apply-templates select="key('ge nre', 'action')">
<xsl:sort select="title"/>
</xsl:apply-templates>

<a name="t2"><H1>A nimation Movies</H1></a>
<xsl:apply-templates select="key('ge nre', 'animation')">
<xsl:sort select="title"/>
</xsl:apply-templates>

<a name="t3"><H1>C omedy Movies</H1></a>
<xsl:apply-templates select="key('ge nre', 'comedy')">
<xsl:sort select="title"/>
</xsl:apply-templates>

<a name="t4"><H1>D rama Movies</H1></a>
<xsl:apply-templates select="key('ge nre', 'drama')">
<xsl:sort select="title"/>
</xsl:apply-templates>

<a name="t5"><H1>S uspense Movies</H1></a>
<xsl:apply-templates select="key('ge nre', 'suspense')">
<xsl:sort select="title"/>
</xsl:apply-templates>
</body>
</html>
</xsl:template>

<xsl:template match="movie">
<table>
<tr>
<td colspan="2"><h2 ><b><xsl:valu e-of select="title" /></b></h2></td>
</tr>
<tr>
<td><b>Date: </b></td> <td><xsl:valu e-of select="date" /></td>
</tr>
<tr>
<td><b>Countr y: </b></td> <td><xsl:valu e-of select="country " /></td>
</tr>
<tr>
<td><b>Language : </b></td> <td><xsl:valu e-of select="languag e" /></td>
</tr>
<tr>
<td><b>Rating : </b></td> <td><xsl:valu e-of select="rating" /></td>
</tr>
<tr>
<td><b>Director : </b></td> <td><xsl:valu e-of select="directo r" /></td>
</tr>
<tr>
<td><b>Actors : </b></td> <td><xsl:valu e-of select="actors" /></td>
</tr>
<tr>
<td><b>Genre: </b></td> <td><xsl:valu e-of select="genre" /></td>
</tr>
<tr>
<td valign="top"><b >Summary: </b></td> <td><xsl:valu e-of select="summary " /></td>
</tr>
</table>
<br></br>
</xsl:template>

<xsl:template match="link">
<link href="{@xlink:h ref}">
<xsl:apply-templates>
</link>
</xsl:template>




</xsl:stylesheet>[/html]
May 2 '07 #1
1 1659
dorinbogdan
839 Recognized Expert Contributor
Welcome to TheScripts TSDN....

The HTML hyperlink tag is <a>, so use:
[html]<a href="{@xlink:h ref}">
<xsl:apply-templates>
</a>[/html]
May 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2356
by: Erik Jälevik | last post by:
Is it possible to use XLink within an XHTML document? I am trying the following in Mozilla Firebird 0.7 (which supposedly supports XLink) and I don't get a link: <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xl="http://www.w3.org/1999/xlink">
0
1629
by: Anna | last post by:
Hello all. I hope this is the right group to ask my question. I have an HTML page that contains an SVG file in an object. Inside an SVG file I want to add a link to link to some anchor on the including HTML page. I tried to do it, but it doesn't seem to work. Here is my example: test.svg: <?xml version="1.0" standalone="no"?>
0
1397
by: Gene Ellis | last post by:
Very simple question. If I have the XML file below: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="newspage.xsl"?> <newspage> <content>Click here for blah blah</content> </newspage> How can I use XLink to make an HTML hyperlink out of the "click here" text?
1
1901
by: Lothar Lemnitzer | last post by:
Dear fellows, I have a problem with matching namespaces in an XML document and an XSLT stylesheet (at least I think that this is the source of trouble). My XML document looks like this: 1 <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> 2 <!DOCTYPE relations SYSTEM "germanet_relations.dtd"> 3 <relations>
0
1276
by: B | last post by:
I am working on an application which reads, writes and generates XBRL-compliant documents. XBRL makes extensive use of XLink in creating these documents. I have so far been unable to ascertain the current support for XLink provided by the System.XML classes. In short, my question is: What is the current level of support for XLink provided by the .NET XML parsers in .NET 1.1 or .NET 2.0? Thanks,
2
22539
by: Carmit | last post by:
Hi, I'm trying to build a proxy for this webservice: http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/EndTransactionLLSRQ.wsdl I'm getting the following error: Error: Unable to import binding 'EndTransactionSoapBinding' from namespace 'http s://webservices.sabre.com/websvc'.
2
1963
by: adMjb | last post by:
Hi Any help would be fantastic I have a simple problem but I cant work it out... DOHH...., this is my XML: <?xml version="1.0" encoding="UTF-8" ?> <?xml-stylesheet type="text/css" href="BSI%20Test.css"?> <document xmlns:xlink="http://www.w3.org/1999/xlink"
4
4764
by: jvanulden | last post by:
Hello all, I am having difficulty figuring out how to create an XmlElement and giving it an attribute that requires a namespace. Here is what I have so far which throws an exception because you can't have a : in an attribute name??? XmlElement eOnlineResource = m_context.CreateElement("OnlineResource"); eOnlineResource.SetAttribute("xlink:href", "http://www.w3c.org/1999/xlink", sldUrl);
0
1536
by: ab.angadbhat | last post by:
hi, I have an element in the xml file which has xlink:href ="xyz.xml" as an attribute. I am using xpointer to point to only 2nd <Uelement of the xyz.xml file and so i am doing:- xlink:href ="xyz.xml#xpointer(//U) In my xslt file i am using
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8886
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.