Re: [xsl] xsl:variable containing xsl:element

Subject: Re: [xsl] xsl:variable containing xsl:element
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 26 Jan 2001 14:52:58 GMT
> I have the following problem when assigning a string to a variable.

You don't want a string, you want a node set.

  // This works fine - displaying the number bold
  This is my account <xsl:element name="b">123.456</xsl:element> now

it would have been simpler to use <b>123.456</b> rather than

 <xsl:variable name="wholestring">This is my account <xsl:element
name="b">123.456</xsl:element> now closed</xsl:variable>

same there, you could have used <b>
That doesn't make $wholestring a string it makes it a reseult tree
fragment consisting of a tree of five nodes

root:    /
text:          "This is my account "
element:       b
text:            "123.456"
text:          " now closed"

 <xsl:value-of select="string($wholestring)"/>

value-of gives the string value of is argument, so the above is
equivalent to

 <xsl:value-of select="$wholestring"/>

the string value of a result tree fragment is just the character data.

You want a copy of the tree itself.

 <xsl:copy-of select="$wholestring"/>

which will wok, although looks confusing as the variable is called
wholestring, but isn't a string.


 XSL-List info and archive:

Current Thread