Re: [xsl] Empty object

Subject: Re: [xsl] Empty object
From: scott gabelhart <swgabel@xxxxxxxxxxxx>
Date: Wed, 28 Jan 2004 11:34:46 -0500
Michael Kay wrote:

Just want in your opinion the best way to deal with this issue so I can adopt it once and forget about it.




My usual practice is to use numeric character references for special characters in XML, ie. to write it as & #xa0; rather than & nbsp;

You don't need to do anything special in your stylesheet to copy the
NBSP character to the output. There are various ways the serializer can
render it (including as a non-breaking space, which probably won't show
up in your text editor) but they will all have the required effect.

Michael Kay


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list





Michael,

now I am completely confused.

If my input xml file contains &nbsp; I add this entity reference to my xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE holdspace [<!ENTITY nbsp "&nbsp;">]>

Now when I open this xml file in XMLSpy I don't get the error message missing entity reference..character data..etc nbsp.

Great.

Now when I run my transform that I sent you against this xml input file the &nbsp that are originally in the xml file of course don't appear in my transformed output. What I get is <OBJECT></OBJECT> instead of my desired result <OBJECT>&nbsp;</OBJECT>.

Obviously I have something not declared properly in my xsl. Where do I place <!DOCTYPE holdspace [<!ENTITY nbsp "&nbsp;">]> in my stylesheet given I am using a syntax of

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; />
<xsl:template match="/">


Sincerely,

Scott

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread