[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: Fri, 26 Jan 2001 14:52:58 GMT
xsl element xsl variable
> 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


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.