Re: [xsl] character entities

Subject: Re: [xsl] character entities
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 21 Nov 2001 12:08:48 GMT
[I'm not sure we're still on topic for this list, but anyway..]

> Uh, my life is interesting enough without them...
Lucky for some:-)

> Well, you can always use a two pass approach. If implementing
> the first pass (expanding the references) in XSLT is a performance
> issue, do it as a SAX handler.

Yes but then basically you are in the same situation as with entities:
You have an expanded document and it isn't necessarily easy to construct
an unexpanded one from a stylesheet. (This isn't all XSLT'S fault it is
just part of a general problem that transformation and editing are
uneasy bedfellows.

> but since you did not mention that you have to put not-well formed
> XML into the entities,

XML entities are always well formed.

> You can use nag:ref-formula, nag:ref-constraint etc.
I could, but it would still make listing all the arguments used in
constraints more complicated than the current
as you'd have to know at all points in the tree where you might find an
indirection, and follow that.
and apart from impressing Jeni that I'd moved into the current millenium
it's not clear what I have gained for this price. (I have considered
this in the past)

> If the references become somewhat standardized, you should be able to
> put this logic into reusable templates.
It's easier to say "reusable templates" than define what it means.

Whether or not I can do it is not really the point (I think I basically
understand XSLT so I could probably make some scheme like that work), it
is certainly a lot harder. Also I'd have to go outside XSLT 1.0 (not
that that necessarily matters) as if the current template goes
select="../param/constraints" to select all the constraints on sibling
parameters, then there is _nothing_ a template can do to create that
node set, as templates don't create nodesets. i could apply templates in
some mode to .. which would then filter down, following any references,
and produce a result tree fragment. I could xx:node-set() that back to a
node set but it wouldn't be the nodes in the original tree, they'ed just
be copies. So information about where the nodes came from is lost.

> It's like moving from FORTRAN to PASCAL :-)
Well since this is documenting a fortran library, changing to pascal
might not be appropriate:-)

> 1. Entities are multi-role, each with a quite different semantic:
>   - text replacement (including by not well-formed XML fragments)
>   - physical structure of the document
>   - reference to non-XML information
>   This is bad.

It's bad the way you describe it but I don't think it's true either.
Taking the last one first. the DTD syntax for Non XML entities is
similar but the instance syntax (an attribute value) is completly
different from the instance &xxx; syntax, so there is no real
intersection of syntax/use here.

The first point is not true, XML entities are well formed by definition.

I'm not sure what is the complaint about the second ppoint. That is
exactly the point of entities: that the logical tree view of the
document should be independednt of any storage structure. That's exactly
what they achieve, and is exactly what is the problem with using some
private reference elements to reflect the storage structure, it shows up
to much in the document tree.

> 2. Entities definitions require DTDs which also may provide a structure
>   definition. How do you mix this and a structure definition by a
>   Schema?

It's like saying how do you mix a w3c Schema definition with a relax NG
one. If you choose to define something in two ways, it's up to you to
make sure they are compatible. Or more simply just define it one way.

> 3. Entity related stuff cannot be generated by XSLT (though this could
>   be fixed by inventing xsl:entityref and DTD generating elements).

Yes of course that was the subject of the thread before we got
side tracked:-)

> My vision is:
[abolish dtd]

that's fine but currently DTD's offer a lot more functionality than
schemas, so this won't happen soon. There are lots of XML editors out
there with context sensitive operations driven by dtds. No doubt people
are working to try to do something similar with schemas, but is it there


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