[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl:variable containing xsl:element

Subject: Re: xsl:variable containing xsl:element
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 29 Jan 2001 09:41:16 GMT
variable containing html code
  The string contains HTML code 

If you think of HTML (or XML) markup being part of a string you'll
always get confused by XSLT. XSLT (unlike, say perl) does not work on
the string representation of an XML document, but on a tree
representation.


  // This doesn't work - displays the number BUT not bold
  <xsl:variable name="wholestring">This is my account <xsl:element
name="b">123.456</xsl:element> now closed</xsl:variable>
  <xsl:value-of select="string($wholestring)"/>


as mentioned before, both string() and value-of() are doing the same thing
here, giving the string value of the expreesion, which will throw away
any element nodes.



  The reason for the variable is that I want to pass it to another template
  using 
  <xsl:call-template name="getConfirmationPage">
    <xsl:with-param name="Header" select="Title/Text"/>
    <xsl:with-param name="Title" select="$wholestring"/>
  </xsl:call-template>

That in itself isn't a reason, you could just use
<xsl:with-param name="Title"
 >This is my account <b>123.456</b> now closed</xsl:with-param>

you don't need a variable if it's only used there.


> The <xsl:copy-of select="$wholestring"/> throws the following error
It shouldn't. Are you sure you have that line somewhere in the scope of
the wholestring variable (that is, in teh same template)

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.