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


Rainer,

> I have the following problem when assigning a string to a variable. The
> string contains HTML code in between.
> 
> <xsl:template match="Language/*">
>   // This works fine - displaying the number bold
>   This is my account <xsl:element name="b">123.456</xsl:element> now closed
>   
>   // This doesn't work
>   <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)"/>
> </xsl:template>

The variable doesn't contain a string, it contains something the XSLT Spec
calls `result tree fragment', i.e. the variable contains text and elements
(and other markup if you include it in the variable definition).

In this case you have to use <xsl:copy-of select="$wholestring" />
-> no xsl:value-of ...
-> no string(...)

Cheers,
Oliver

/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/


 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]