473,791 Members | 3,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT help with href

Hello there,

I'm trying to generate a hyperlink (href) using XSLT to generate a web
page that displays a table with selected information. At the moment
everything is working except for the hyperlink which I can't seem to
get my head around. I have the XSLT code listed below so if anyone can
let me know what the problem is with my script I would be greatly
appreciated. Here is the code:

<?xml version="1.0"?>
<xsl:styleshe et
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40">
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>

<xsl:template match="/">
<html>
<head>
<title>Bob Action Log</title>
</head>
<body>
<P>Here are the log files for the individual builds</P>
<table border="1">
<tr>
<th align="center"> Build Step</th>
<th align="center"> Arch</th>
<th align="center"> Config</th>
<th align="center"> Action</th>
<th align="center"> Build Started At</th>
<th align="center"> Build Time</th>
<th align="center"> RESULT</th>
</tr>
<xsl:for-each select="BobActi vityLog/ActionLog">
<tr>
<td><xsl:valu e-of select="StepNam e"/></td>
<td><xsl:valu e-of select="Arch"/></td>
<td><xsl:valu e-of select="Config"/></td>
<td><xsl:valu e-of select="Action"/></td>
<td><xsl:valu e-of select="TimeSta mp"/></td>
<td><xsl:valu e-of select="BuildTi me"/></td>
<xsl:choose>
<xsl:when test="Result = 0">
<td>PASS</td>
</xsl:when>
<xsl:otherwis e>
<td bgcolor="pink">
<xsl:attribut e name="title">
<xsl:value-of select="MainErr "/>
</xsl:attribute>
<xsl:attribut e name="href">
<xsl:value-of select="StepNam e"/>
</xsl:attribute>
FAIL (<xsl:value-of select="Result"/>)</td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Nov 27 '06 #1
2 4052
At a quick glance, I don't see anything obviously wrong. What does your
input look like, what output are you trying to get, what output are you
actually getting?
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Nov 27 '06 #2
Craig wrote:

I'm trying to generate a hyperlink (href) using XSLT to generate a web
page that displays a table with selected information. At the moment
everything is working except for the hyperlink which I can't seem to
get my head around.
<xsl:styleshe et
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40">
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^

If you want to generate HTML 4 output then remove that namespace
declaration as HTML does not know any namespaces.
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/>
<td bgcolor="pink">
<xsl:attribut e name="title">
<xsl:value-of select="MainErr "/>
</xsl:attribute>
<xsl:attribut e name="href">
<xsl:value-of select="StepNam e"/>
</xsl:attribute>
FAIL (<xsl:value-of select="Result"/>)</td>
You are generating a href attribute on a td element but with HTML you
need an a element e.g
<a>
<xsl:attribut e name="href">
<xsl:value-of select="StepNam e"/>
</xsl:attribute>
some link content here
</a>
or easier with an attribute value template as
<a href="{StepName }">some link content here</a>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2712
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron extension responsible for the xslt functions. The problem i have is that the obtained transformation is not the waited one. I try to proccess the same XML file with XSL file with a program called XMLspy and i obtained the desire and waited...
6
2749
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a straight XML file http://www.discovertravelandtours.com/test/templates/test.xml?Location=Germany To another XML file http://www.discovertravelandtours.com/test/templates/test2.xml?Location=Germany
12
3238
by: gipsy boy | last post by:
Hello, I have sort of a big problem. I would really appreciate any help you could give me. I made a web service in C++ that throws XML to the client (browser). But, the XSLT transormation (xml->html) doen't happen! I have XSLT files for this, they work, I mean when I put the output of the app as an XML file on some server, and make it use the XSLT files to transform into HTML, it works, I get a HTML page.
2
1633
by: FrankStallone | last post by:
I am just getting started in XML and I made my first xml, dtd and xslt file and XML spy said they were all valid and they worked. This was the xslt doc that worked. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/">
5
1467
by: dennis | last post by:
Hi, First of all, hi to you all. I'm working on a Delphi project wich is becoming near it's deadline. I have a very simple XSLT question wich i hope one of you folks can help me with? The problem is i need to transform a xml file from this: <root>
7
2871
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID); xmlItems.TransformArgumentList = xsltArgList;
1
1274
by: Foxpointe | last post by:
Given some arbitrary XHTML, I'd like to obtain a 'simplified' XHTML result which strips out a large subset of standard elements and attributes - but not all. The main things I would like to accomplish: 1) Provide a list of elements/attributes to be stripped (i.e. everything else should be passed through) or those that should be passed through (i.e. everything else should be stripped) which would be applied recursively. 2) If an element...
4
7723
by: th1421 | last post by:
Hi, I'm new to FireFox. I am currently trying to convert my website to be compatible with it. Doing so I’m trying to process some XML/XSLT pages (preferably without using JavaScript). When I view my XML pages using IE 6 or 7 it displays beautifully both accessed locally as through HTTP on my ISP’s server where I put them using FTP. When I view them in Mozilla FireFox 2.0, it displays ok when accessed locally. The CSS presentation –...
4
2760
by: mark4asp | last post by:
I want to write a xslt template to create a xhtml 1.0 (transitional) file which will be sent in as email. Here is a typical xml data file: <BatchEmail> <Domain>www.myDomain.com</Domain> <Destination> <Salutation>Hi Mark</Salutation> <UniqueID>4120</UniqueID>
2
22780
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values in the attribute of an element. Instead of using the <xsl:attribute> element, you can simply place the xpath in the attribute itself. The most common usage of this is in creating hyperlinks.
0
9669
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
10428
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
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10156
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9030
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
7537
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
5435
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...
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2916
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.