Re: [xsl] generating numerical character entities in html output

Subject: Re: [xsl] generating numerical character entities in html output
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 18 Jan 2005 12:25:36 GMT
  , it 
  *should* be possible to generate it so the impossibility or difficulty in 
  doing it should be considered something of a "bug" of xslt. I can live with 
  that :-) but it's a pity anyway.

It's not so much a bug but rather a feature of the design.  XSLT is a
tree manipulation language, you get virtually no information on the tags
used in the source and only  have the possibility of giving some
optional hints as to how the result tree should be written out.

<foo a="2">b</foo>

and

<foo a = '2'

><![CDATA[b]]></foo
>

produce identical input to XSLT lexical details of teh markup such as
white space inside tags, whether " or ' was used for attribute values
and whether CDATA sections or entity references were used is all
resolved by the XML parser. You can't tell which form is used on input and 
you can only give vague hints as to which form you would like on
output. (It may be that you do not output using tags at all, but just
pass the tree straight to another processor, usually some kind of DOM
API, or in mozilla, the tree is passed straight to the rendering engine,
no tags are ever generated.

whether character references are used comes under this same category of
unimportant lexical details that you shouldn't have to worry about.

Sometimes you do care about the way the XML is linearised, perhaps for
educational purposes or to work with legacy not-really-xml systems
but in such cases often you don't want to use xslt at all, or do teh
transformation with xslt but post process with a non-xml text processing
system such as sed or perl that can manipulate tags and references.
No system that uses an XML parser on input can ever give you full
control over such details.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread