473,666 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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">ho me 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:valu e-of select="/bio/homepage" />">home page</A>
OR
B) single quote, <A HREF='<xsl:valu e-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:valu e-of select="@id"/>'>

any ideas? please advise. thanks!!
Jul 20 '05 #1
1 15081
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:attribut e> instruction, e.g.
<A>
<xsl:attribut e name="HREF">
<xsl:call-template name="build-the-href"/>
</xsl:attribute>
<xsl:text>hom e page</xsl:text>
</A>
HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator
"Matt" <jr********@hot mail.com> wrote in message
news:ba******** *************** **@posting.goog le.com...
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">ho me 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:valu e-of select="/bio/homepage" />">home page</A> OR
B) single quote, <A HREF='<xsl:valu e-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:valu e-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
1567
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 want to apply a stylesheet such that the XML is exactly the same apart from the only <row> should be the first one from the XML below. I can output some text for position()=1 but I can't output the original XML too. So the only thing I get in my...
5
1800
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: for($i=0;$i<LIMIT;$i++) { // Something using $i }
3
1328
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
1809
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; &lt;tr&gt;&lt;td&gt;some sample text runs here&lt;/td&gt;&lt;td&gt;some sample text runs here too&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;some sample text runs here&lt;/td&gt;&lt;td&gt;some
5
2163
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" archive="prog/MyApplet.jar" width="100%" height="99%">
4
1813
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 do the following: <xsl:template
1
2771
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 drawback. I cannot seem to find a way to attach to the events generated by controls generated by the XSL transformation. I have tried the FindControl on the page, but it does not find the control. There must be something I am doing wrong because I...
0
3208
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 getting"The 'DataSource' property is set only by the runtime. It cannotbe declared." error code: <?xml version="1.0"?> <xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"xmlns:MyObj="urn:ProductInfo" xmlns:asp="remove">...
3
1232
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 stick the variable in place: <xsl:element name="XYZ:{$variable}">
8
4462
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" /" target="_blank"> <xsl:apply-templates select="key" mode="getValue" /> <xsl:text> </xsl:text>
0
8356
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
8871
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
8781
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...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
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
6198
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
5664
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
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1776
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.