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 July 22nd, 2010, 09:02 AM
Authorized User
 
Join Date: Jul 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default attach the xsl variable into the attribute html tag

Hi,
I'd know the procedure for attach the xsl variable into the attribute html tag, my code is:

<xsl:variable name="companyName" select="'Company'"/>

<img src="../Divisions/$companyName/images/logo.jpg" alt="Comppany Group" />

or

<img src="../Divisions/*[name()=$companyName]/images/logo.jpg" alt="Comppany Group" />

but, both not ok

Thanks!
 
Old July 22nd, 2010, 09:15 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You need to use the concat function.
Code:
concat('divisions/', $companyName, '/image.jpg')
__________________
Joe
http://joe.fawcett.name/
 
Old July 22nd, 2010, 09:18 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You either want to use <xsl:attribute> or Attribute Value Templates.

There is little point in storing the company name in a variable unless you are going to use it more than once as well.

Code:
<img src="http://p2p.wrox.com/Divisions/{Company}/images/logo.jpg" ...>
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old July 22nd, 2010, 09:19 AM
Authorized User
 
Join Date: Jul 2010
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I resolved....

<xsl:variable name="companyName" select="'Company'"/>

<img src="../Divisions/{$companyName}/images/logo.jpg"/>

Thanks for your solution!!!





Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl:function pass param to attribute of xsl:instruction bonekrusher XSLT 4 March 31st, 2009 09:06 AM
HTML tag from C# or ASP.NET tag from javascript angshujit ASP.NET 2.0 Basics 3 February 16th, 2007 10:07 AM
html option value assigned to xsl:variable bergs77 XSLT 2 February 23rd, 2006 02:27 PM
xsl variable in xsl tag? di98svpa XSLT 1 February 10th, 2006 01:41 PM
<xsl:for-each> with a variable select="attribute" BeneathClouds XSLT 1 August 1st, 2005 03:36 AM





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