Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 12th, 2004, 05:56 AM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Including XSL in an <a href>

I'm trying to create a mail-to link in an XSL stylesheet. Part of the e-mail address comes from within the XML.

This is my code...

<br/><b>EMAIL:</b> <a href="mailto:agent-<xsl:value-of select='OrderReferences/ProjectCode'/>@foo.com">Mail</a>

However, IE returns the error

The character '<' cannot be used in an attribute value.

How can I include xsl as part of my <a href=....??

TIA

 
Old November 12th, 2004, 06:03 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The easiest way is to use Attribute Value Templates (AVT):
Code:
<a href="mailto:agent-{OrderReferences/ProjectCode}@foo.com">Mail</a>
Anything in {} is treated as an XPath expression. (Not all atttributes within xslt support this style.)

You could also create the attribute the long way using xsl:attribute:
Code:
<a><xsl:attribute name="href">mailto:agent-<xsl:value-of select='OrderReferences/ProjectCode'/>@foo.com</xsl:attribute>Mail</a>


--

Joe (Microsoft MVP - XML)
 
Old November 12th, 2004, 06:08 AM
Registered User
 
Join Date: Oct 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Simple when you know how!

Thanks very much :D

Graham






Similar Threads
Thread Thread Starter Forum Replies Last Post
embedded <xsl:element> into <xsl:with-param> petergoodman XSLT 2 July 9th, 2008 06:36 AM
Performance for <xsl:import> and <xsl:include> vikkiefd XSLT 2 April 16th, 2008 08:06 AM
<xsl:choose> and <xsl:otherwise> problem djmarquette XSLT 4 January 21st, 2005 01:56 PM
<href> causing problems mahulda ASP.NET 1.0 and 1.1 Basics 5 July 15th, 2004 12:15 PM
including '<' or '>' sign in a string inside XML texasraven Classic ASP XML 1 February 26th, 2004 03:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.