More entity confusion and my opinion on the right way

Subject: More entity confusion and my opinion on the right way
From: Andrew Bunner <bunner@xxxxxxxxxxxxxxxxxx>
Date: Tue, 05 Jan 1999 14:36:37 -0800
  Here's what I don't understand about the entity-writing problem...

  If I include &amp; in my source document or stylesheet, I get &amp; in my
result document (this is good since my result document is HMTL).

  If I include &quot; in my source document or stylesheet, I get " in the
result document. Hmm. OK.

  Of even greater confusion to me is if I include &copy; in my source document.
In this case, I get an error... &copy; references an undefined entity. BUT, if
I include &#169; in my source document, I get &copy; in the result document.
'Hooray!' I think to myself, this must mean that if I include an entity
reference to an ascii code, it will get translated to the right HTML entity.

  Wrong.

  &#32; (space) gets translated to the space character, not to &nbsp;

  So, upon reflection, my post-processing solution isn't very good. What if I
want &quot; to appear in the result document? That entity is already defined in
XML. Should I insert special "entity tags" like <myhack:nbsp/> and then write
out "unusual" strings (ala ##nbsp##) for which I can grep and then replace with
ampersand-ed references?

  Does anyone have any thoughts?

  My thinking is that the "right" way to do this is to somehow let the XSL
processor know which entities are allowed to appear in the result document.
Could we expand on the resultns attribute? Maybe it should reference a DTD for
the result document... then the XSL processor can read the result document's
DTD and decide which entities it should write out and which ones it should
complain about.

-- Andrew

   Andrew Bunner
   President, Mass Quantities, Inc.
   bunner@xxxxxxxxxxxxxxxxxx
   Professional Supplements for the Perfect Physique
   http://www.massquantities.com 
   


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


Current Thread