[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: strangeness with <xsl:variable>

Subject: Re: strangeness with <xsl:variable>
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 20 Dec 2000 21:29:32 GMT
xsl ignore white space


> And that works.  This doesn't seem right, because shouldn't
> XSLT ignore the whitespace before the "chap"?  Or is
> <xsl:variable> an exception to the rule?

No look again at th espec, XSL doesn't ignore white space.
It stips white space nodes, ie text nodes that only contain white
space. But if a text node contains any non white char eg "chap" then all
white space is preserved.

Since a literal newline in an attribute value would be normalised
to a space by an XML parser, your newline in the attribute value
is written out as a character reference.

> thought the natural way to do this is to use a
> <xsl:variable> within a <xsl:choose>.
The scope of a variable binding is its surrounding element, so if you do
it that way the variable goes out of scope at the </xsl:when>
so can never be used.


It's more natural the other way. You always want a variable, but the
value is conditional on the tests. It's not that depending on a
condition you may or may not want a variable.

so it's x= (if foo 3 else 5 fi)

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


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.