Re: Where did my tabs go? Trying to understand xsl:va
why can't I use the following to the same success?
essentialy the reason is that amp is _defined_ to be already double
I guess this is more about XML than it is about XSLT, but since XSLT *is* XML, I thought to look it up, now that I understand where to look. The following example actually explained enough, just by looking at it ( http://www.w3.org/TR/xml/#intern-replacement )
The following declarations: <!ENTITY % pub "Éditions Gallimard" > <!ENTITY rights "All rights reserved" > <!ENTITY book "La Peste: Albert Camus, © 1947 %pub;. &rights;" >
Becomes the following replacement string: La Peste: Albert Camus, ) 1947 Iditions Gallimard. &rights;
The general-entity reference "&rights;" would be expanded should the reference "&book;" appear in the document's content or an attribute value.
My guess is that this also happens when using named predefined entity references. So, you are absolutely right, there's a difference in expansion of named entity references and numeric entity references, where the latter are replaced in place, and the former actually end up in the document. In our scenario this would give:
This declaration <!ENTITY tab "&#x09;">
Becomes this replacement string: &#x09;
This replacement string is used inside the XML document (which is the xslt stylesheet), and after parsing becomes the literal string: 	 Only if it were parsed again, it would be replaced with a [tab] character. Whereas the following (from your resolution):
This declaration <!ENTITY tab "&38;#x09;">
Becomes this replacement string:
This then, will be expanded in the XML as a literal [tab] character.
Never knew there were so much trickery involved. I wonder what normalize-space(normalize-space('&tab;')) would do. Will it remove the whitespace? Well, never mind, to be sure of correct handling, I think I stick to the safe-haven of character maps, now that I learned how to apply them.
Thanks for all the help, David!
Cheers, -- Abel Braaksma
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