473,378 Members | 1,420 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,378 software developers and data experts.

How to put XSLT element <xsl:value-of> inside an HTML tag?

For example, how to represent hyperlink in XSL? I want to add hyperlink in XSL.
i.e. I need to generate <A HREF="http://mypage.html">home page</A> in HTML.

I tried the following approaches but still not work, it don't display anything

Approach #1: direct link, not work

A) double quote, <A HREF="<xsl:value-of select="/bio/homepage" />">home page</A>
OR
B) single quote, <A HREF='<xsl:value-of select="/bio/homepage" />'>home page</A>

Approach #2: introduce new variable, not work
<xsl:variable name="hp" select="/bio/homepage" />
<A HREF="$hp">my page</A>

Another example, if I do this, it don't display anything also.
<select name='<xsl:value-of select="@id"/>'>

any ideas? please advise. thanks!!
Jul 20 '05 #1
1 15051
Hi Matt,

You can use AVTs (attribute value templates) for most simple expressions.
AVTs are expressions within attributes enclosed with {} curly braces, e.g.

<A HREF="{/bio/homepage}">home page</A>

When you need to generate the value of an attribute using more complex XSLT
(e.g. the value is to be built using template calls or the like) then you
can use the <xsl:attribute> instruction, e.g.
<A>
<xsl:attribute name="HREF">
<xsl:call-template name="build-the-href"/>
</xsl:attribute>
<xsl:text>home page</xsl:text>
</A>
HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator
"Matt" <jr********@hotmail.com> wrote in message
news:ba*************************@posting.google.co m...
For example, how to represent hyperlink in XSL? I want to add hyperlink in XSL. i.e. I need to generate <A HREF="http://mypage.html">home page</A> in HTML.
I tried the following approaches but still not work, it don't display anything
Approach #1: direct link, not work

A) double quote, <A HREF="<xsl:value-of select="/bio/homepage" />">home page</A> OR
B) single quote, <A HREF='<xsl:value-of select="/bio/homepage" />'>home page</A>
Approach #2: introduce new variable, not work
<xsl:variable name="hp" select="/bio/homepage" />
<A HREF="$hp">my page</A>

Another example, if I do this, it don't display anything also.
<select name='<xsl:value-of select="@id"/>'>

any ideas? please advise. thanks!!

Jul 20 '05 #2

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

Similar topics

1
by: Paul Smith | last post by:
Apologies, I am new to XSLT. I am having trouble with something that I would expect to be quite straightforward. How do I leave XML tags as they are in a transformation? From the XML below, I...
5
by: Miguel J. Jiménez | last post by:
Hi, I need to make a FOR structure using XSL... ie. I want to make a structure for moving between 0 and x, being x a variable name... How can I do this? In PHP/Java would be something like this: ...
3
by: Jijai | last post by:
Hi All, I need your help. I have spent almost one day to figure this out, here is my problem: In my dtd: <!ELEMENT para (#PCDATA | math | link)+> In my xml:
4
by: Figo 775 | last post by:
Hi, I have an xml document which is as below: <?xml version="1.0" encoding="UTF-8"?> <fragment name="htmlPart"> <value>&lt;table&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;Feature&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b &gt;Benefit&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;...
5
by: Gerald Aichholzer | last post by:
Hello NG, I have an XHMTL-file and would like to replace attribute values using XSLT. The XHTML-file contains the following code: <applet code="MyApplet/MyApplet.class"...
4
by: dwa | last post by:
Is it legal to use a parameter in a <template match> ? If I do the following: <xsl:template match="/ContentRoot/Content/Categories/Category"> ....everything works as expected. But if I...
1
by: MikeC | last post by:
For ASP.Net/C Sharp I have an XML file and an associated XSL file. I am using the System.Web.UI.Controls.Xml control to render the resulting HTML. This seems to work fine with one slight...
0
by: Ganesh Kolappan via .NET 247 | last post by:
Hi I am trying to populate a <asp:dropdownlist> in a XSLT file withdatasource pointing to a C# codebehind file method which returnsa dataview. I am using XSLT extension object. But I am...
3
by: mikea_59 | last post by:
How can I generate element names by calling a function? Something like this: <xsl:element name="XYZ:{call_some_local_function_here}"> Do I need to put the function reply in a variable and...
8
by: Larry | last post by:
Hi, I'm trying to get the following working but I'm at a loss and dont know what is wrong with it: <div class="name"> <a href=" <xsl:apply-templates select="key" mode="getValue" /"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...

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.