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 June 23rd, 2003, 08:08 PM
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML to HTML

Anyone know how to use a variable in a src="" instruction. I want to be able to have dynamic server names that point to the correct path of an image. This would be used when transforming xml to html. If I have a variable 'Server' set equal to "http://www.development/" or "http://www.production", how could I include this in my src instruction? Something like <img src='$Server/Images/dog.gif'>. I tried concat($Server, 'Images/dog.gif'), but the resulf of the transformation is just; <img src='$Server/Images/dog.gif'>. What I was hoping for was something like; <img src='http://www.production/Images/dog.gif'>. Any suggestions?

Thanks,

Ben
 
Old June 24th, 2003, 12:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 147
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to armmarti
Default

I think the most convenient way is to use "attribute value templates" concept.
Just write:
Code:
   <xsl:variable name="Server" select="'http://www.development'"/>

   <img src="{$Server}/Images/dog.gif"/>
In HTML output the "img" literal result element will be as follows:
Code:
  <img src="http://www.development/Images/dog.gif"/>
Regards,
Armen
 
Old June 24th, 2003, 08:49 AM
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Armen,

Thanks for the help. The attribut value template concept works great. Looks like I have some reading to catch up on.

Thanks again,

Ben





Similar Threads
Thread Thread Starter Forum Replies Last Post
xml to html with xsl boblavinsky XSLT 4 January 5th, 2007 05:30 AM
Is XML supports transformation of HTML to XML? zeeonline XSLT 1 July 28th, 2006 05:13 PM
Html to XML stevoie XSLT 2 February 6th, 2006 12:37 PM
About HTML and XML sachinkumar XML 1 June 28th, 2005 10:30 AM





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