Re: [xsl] Replace content of element, then transform it...

Subject: Re: [xsl] Replace content of element, then transform it...
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 30 Aug 2012 12:57:31 -0400
Trond,

Yes, Firefox is a good example of a problematic case since its processor transforms the tree and then treats it directly as an HTML DOM for display. In other words, no serialization, and no parsing after the initial parse of the XML. So there is no opportunity to disable output escaping (no output of this sort to escape), and hence no d-o-e.

(In contrast, it appears that IE asks MSXML to transform and then serialize the transformation results, then pass that character stream to its HTML parser -- so d-o-e works in IE. Whether you think this is good or bad, it's confusing.)

I'm sure that other contributors can remark on other browsers and environments. The takeaway is that the architecture is everything, and for the sake of sanity if nothing else you want to avoid boundary violations (as Mike said) such as the one between XML parsing/serialization and XSLT tree transformation.

One possible approach would be to run all your input through an initial process that would parse and rewrite it to disk, with output escaping disabled. Then when parsing it again you would have everything in your tree. Thus you'd reduce your problem to (a) catching and handling pseudo-markup in the input that wasn't (pseudo) well-formed, and (b) managing tagging semantics and vocabulary clashes in your mixed markup. But maybe you already have namespaces to help with that problem (which is a problem anyway).

Good luck,
Wendell

--
======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
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
======================================================================

Current Thread