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 December 31st, 2004, 05:57 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Default Trying to output a tag within a tag

I'm using XSL to transform XML to HTML. Mostly it is working ok, however I get a parse error when trying to output the <xsl:value-of> tag within a html <a> tag:

Code:
<td class="StarText" width="10%">
    <a title="Click here for more details" target="_top" href=<xsl:value-of select="//fulldetails"/>>
    <img border="0" valign="top" src="http://www2.vebra.com/solex/19998/0099a01010009910039.jpg" /></a>
</td>
I've tried putting the <a> tag and closing tag within
Code:
<![CDATA[]]>
sections, and that didn't work

 
Old December 31st, 2004, 08:08 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

A stylesheet has to be valid XML, and XML doesn't allow elements to appear within attributes.

Look up "attribute value templates":

<a href="{$x}">



Michael Kay
http://www.saxonica.com/
 
Old January 7th, 2005, 01:09 PM
Registered User
 
Join Date: Mar 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is what you have to do:

<a>
<xsl:attribute name="href">
<xsl:value-of select="select="//fulldetails"/>
</xsl:attribute>
<xsl:attribute name="title">
Click here for more details
</xsl:attribute>
... and so on for other atributes and their values.
</a>

Hope this helps.

Ajay S
[email protected]
NYC

 
Old January 12th, 2005, 11:57 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Default

That works fantastically well, thank you very much!






Similar Threads
Thread Thread Starter Forum Replies Last Post
copying a tag to output based on a query anboss XSLT 6 July 17th, 2008 11:10 AM
Extra xmlns="" tag in output Mango_Lier XSLT 4 October 16th, 2007 11:35 AM
HTML tag from C# or ASP.NET tag from javascript angshujit ASP.NET 2.0 Basics 3 February 16th, 2007 10:07 AM
How to force XSLT to output a close tag in XML? richcon XSLT 2 June 29th, 2006 02:39 AM
HTML tag vs Body Tag CFGerry BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 October 7th, 2005 07:13 AM





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