473,396 Members | 1,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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:stylesheet
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="BobActivityLog/ActionLog">
<tr>
<td><xsl:value-of select="StepName"/></td>
<td><xsl:value-of select="Arch"/></td>
<td><xsl:value-of select="Config"/></td>
<td><xsl:value-of select="Action"/></td>
<td><xsl:value-of select="TimeStamp"/></td>
<td><xsl:value-of select="BuildTime"/></td>
<xsl:choose>
<xsl:when test="Result = 0">
<td>PASS</td>
</xsl:when>
<xsl:otherwise>
<td bgcolor="pink">
<xsl:attribute name="title">
<xsl:value-of select="MainErr"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="StepName"/>
</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 4036
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:stylesheet
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:attribute name="title">
<xsl:value-of select="MainErr"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="StepName"/>
</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:attribute name="href">
<xsl:value-of select="StepName"/>
</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
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...
6
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...
12
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...
2
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"...
5
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...
7
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...
1
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...
4
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...
4
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>...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.