Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 12th, 2004, 05:56 AM
Registered User
 
Join Date: Oct 2004
Location: , , United Kingdom.
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

Reply With Quote
  #2 (permalink)  
Old November 12th, 2004, 06:03 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
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)
Reply With Quote
  #3 (permalink)  
Old November 12th, 2004, 06:08 AM
Registered User
 
Join Date: Oct 2004
Location: , , United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Simple when you know how!

Thanks very much :D

Graham

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:23 PM.


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