This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: xsl:variable containing xsl:element



  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]