At 2005-12-11 19:21 +0000, Martin Bryan wrote:
>At the Atlanta meeting is was claimed that "XSLT 2.0 has an entity renaming
>mechanism" (according to my very scanty notes). In reviewing the XSLT 2.0
>spec I cannot find such a facility. I can see a character mapping
>declaration that will allow an entity declaration such as to be
>mapped to a single character, such as  ,
I haven't looked in detail at this, but yes I gather that is available.
>but not facilities for
>outputting entity references in a transformed document. Unless someone
>informs me how to rename entities using XSLT 2.0 I must presume that the
>only way to do this is by creating CDATA sections that contain the relevant
>entity reference.
But that isn't an entity reference ... the downstream processor will
see the use of the ampersand as if it were "&", not
"&". Remember that CDATA is only syntactic sugar to prevent the XML
author from escaping markup characters. It isn't a short-form for
adding markup. If you want an entity reference, you need to add
markup, not adding characters that look like markup.
And if you resorted to the (evil) disable-output-escaping= facility,
then the result would not be well-formed because the entity reference
would not be resolved in the DTD (unless, of course, you used a
DOCTYPE in the result tree that pointed to an external declaration
subset). Not even considering that if your result tree is passed on
as the input tree to a downstream process (without realizing the
angle brackets as an external file and reparsing) the ampersand is in
the result tree as "&" and just looks like a character (not an
entity reference) to the downstream process acting on the result
tree. Remember that the XPath data model doesn't have entity references.
>Suggestions as to how entity renaming can be undertaken in
>practice would be very much welcomed.
A DOM data model contains entity references ... could you use
that? Does it cover the bases for ensuring you have the required
declaration for the renamed entity so that the result is
well-formed? Remember it is not an error for two declarations of the
same entity (first one wins) so what happens if you rename "a" to "b"
but "b" already exists? To be well-formed there must already be an
entity named "b". If you add "a"'s declaration as a declaration for
newly renamed "b", which definition with the old "b"'s get? Will "a"
accidentally get the old b's declaration?
What is the use case for entity renaming?
. . . . . . . Ken
-- Upcoming XSLT/XSL-FO hands-on courses: Denver,CO March 13-17,2006 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/d/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/d/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal -- DSDL members discussion list To unsubscribe, please send a message with the command "unsubscribe" to dsdl-discuss-request@dsdl.org (mailto:dsdl-discuss-request@dsdl.org?Subject=unsubscribe)Received on Sun Dec 11 21:49:07 2005
This archive was generated by hypermail 2.1.8 : Mon Dec 12 2005 - 19:33:02 UTC