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

M

Matt

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!!
 
M

Marrow

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

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top