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

Re: Where did my tabs go? Trying to understand xsl:va

Subject: Re: Where did my tabs go? Trying to understand xsl:value-of, tabs and the separator attribute
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 16 Oct 2006 19:33:28 +0100
x09
> (no tabs) <xsl:value-of select="somenode" separator="{&tab;}" />

That one's an error: the &tab; is expanded before xslt starts so it is an
AVT where the expression in {} is just a tab character which isn't a
legal xpath expression.

>  was under the impression that it didn't matter whether 
> you had a numerical entity reference of something, or a named entity 
> reference.

That's true they are all resolved before xslt starts so the xslt engine
can not treat them differently. except you have to interpret "true" in
the previous sentence with some care:-)

tabs in attribute values are normalised by an XML parser to spaces
unless they are entered as numeric character references.
and due to the details of the way entities are expanded your tab entity
expands to a tab character not to the character reference, so if you put
a literal tab or tab entity ref into any xml attribute the xml
application (eg the xslt engine) sees a space.
To stop this you need to use the character reference to #x09; or if you
want to use a named entity, define it to be a character reference, not a
character as in tab2 below

<!DOCTYPE x [
<!ENTITY tab "&#x09;" >
<!ENTITY tab2 "&#38;#x09;" >
]>
<x>

<a x="	" b="&#9;" c="&tab;" d="&tab2;"/>
</x>

run that past an xml parser and it will report


<!DOCTYPE x [
<!ENTITY tab "&#x09;" >
<!ENTITY tab2 "&#38;#x09;" >
]>
<x>

<y d="	" c=" " b="	" a=" "/>
</x>


a and c have value a space, b and d have value a tab.

isn't white space fun??

David

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-2011 All Rights Reserved.