[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl:variable containing xsl:element
> 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 closed it would have been simpler to use <b>123.456</b> rather than xsl:element. <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. David XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|