Re: [xsl] Is there a way to avoid Empty Values?

Subject: Re: [xsl] Is there a way to avoid Empty Values?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 12 Apr 2007 14:42:40 +0200
George Cristian Bina wrote:
Hi Colin,

Sure, that was just an example.
I guess one can eventually test if the character is present in the file and issue an error in that case.



That'd be way too much trouble for a simple workaround. The PUA characters (U+E000 - U+F8FF), or the 15th / 16th plane (U+F0000 - U+FFFFF and U+100000 - U+10FFFF) should (?) be used for such purposes. To make the code more readable, I usually use one DTD include that contains my own private characters as entities. I.e.:


<!-- inside DTD -->
<!ENTITY empty_string "&#xE0E1;">

<!-- in xslt stylesheet -->
<xsl:character-map name="use-empty">
   <xsl:output-character character="&empty_string;" string="" />
</xsl:character>


PUA characters are meant for private use only and are guaranteed to never be assigned any Unicode character, which makes them ideal for this type of workarounds. Of course, there still is a slight chance that your input contains these PUA characters, but I reckon that more often than not, this is known beforehand and you can choose your characters wisely.


-- Abel

Current Thread