xsl-list
[Top] [All Lists]

Re: Yet Another Entity Ref question!

2002-12-20 11:02:22
Marco,

At 07:48 AM 12/20/2002, you wrote:
But I ask to myself (and to you): "Does it exist a method of outputting &
in resulting doc without using d-o-e, so that I can use my originally
solution?"
Yes I know, I'm asking for outputting a non-well-formed XML doc!!

This is not an uncommon requirement: to have special characters in your output represented by entities, not numeric character references.

The thing is, it is far less common in the scenario for which XSLT was (primarily) designed, namely "styling a document" (i.e. transforming it into an output format to be rendered by a formatter, not necessarily into any arbitrary XML). It comes up frequently in part because XSLT is being used to do other sorts of transformations (such as a "medial" transformation into a form that will later be edited by a human being: people tend to like named entities better than numeric character refs, after all). Given this gap between its 1.0 design and what have turned out to be common use cases, it's more understandable why XSLT lacks a feature to do this directly.

(I think XSLT 2.0 has one? If not, I shouldn't think it would be hard to implement a serializer that would be able to do this, when called on from a 1.0 stylesheet.)

Yes probably, to use original solution, the only way is using d-o-e in
xsl:text and xsl:value-of.

Yes -- but this is best implemented as a *post-process*, that is a *separate pass* over your data. This keeps the two processes -- node transformation and data massaging -- separate, thereby preserving your ability to use them separately (which you might). Nor does the data-massaging post-process have to be written in XSLT -- there are other tools that are arguably better for the job.

Cheers,
Wendell


======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



<Prev in Thread] Current Thread [Next in Thread>