Re: [xsl] character entities

Subject: Re: [xsl] character entities
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 20 Nov 2001 15:26:19 GMT
> I think we've had this discussion before, haven't we?

probably, staring at those is what I do when I'm not chatting here....

> but in most transformations these should be parsed along with the rest of the
> document.

There's the rub. In most of the stylesheets, that's true and that's what
we do. the stylesheet called by that script though (which if you may
notice replaced the original input file  (#1) by the result of the
transformation) implements a logic that goes something like 
  "in a new enhanced markup for next version of the product, if the
   paramhead element had these 6 attributes and it's the right phase of
   the moon and the parent element has six children four of which are non
   empty then add a new attribute yes="no" to the element."

Now, XSLT is fine for encoding the logic (except for the bit about the
current phase of the moon, which the exslt date templates don't seem to
handle:-) but I really want the result to be the file that went in not
that file fully expanded. the reason that &e04BL-a; is an entity
reference is that that parameter description probably occurs in several
different routines and you want to make sure that the descriptions stay
in sync, and I'd like to keep it that way.

> It's also more than a little tempting to just say use
> XInclude or XLink rather than entities, which are *so* last millenium
> ;)

Yes but the NAG library is 30 years old this year (and still going
strong:-) and "just" updating 1200 XML files which use a DTD that has, as
I say, thousands of these things to use x{link|include} is
a) scary
b) no help.
It's no help in the general case (and neither is the shell script that I
showed) as if you use xinclude either the xinclusion doesn't happen
and you just see the xinclude elements, that way you can keep the
references, but if the logic of the stylesheet requires seeing into
the replacement texts you are stumped (without a lot of work) or
the xinclusion does happen before the stylesheet processing, but then
you are in the same position as entities, the stylesheet has the
expanded tree and can't put it back as it was.

Also entities currently give a much tighter degree of validation than
I'd get with xinclude. (unless you validate after xinclusion)

so... what I'd like (Mike:-) is for the entities to get expanded on the
way in, but to have some markers in the stream so I can fold them up
on the way out. (You can do this by hand by editing the dtd to add pi's
at the beginning and end of every entity definition, but it's a bit of a


This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:

Current Thread