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

Matt (archive)

Usenet Archive
Joined
Jan 13, 2000
Messages
739
Reaction score
0
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!!
 

Marrow (2)

Usenet Archive
Joined
Nov 19, 2003
Messages
37
Reaction score
0
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,799
Members
249,594
Latest member
henrywalsh

Latest Threads

Top