RE: [xsl] Identity transformation for XSLT 2.0

Subject: RE: [xsl] Identity transformation for XSLT 2.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 17 Dec 2007 09:55:04 -0000
> I have tried to make a stylesheet that can make a complete 
> identity transformation in XSLT 2.0. I have probably 
> forgotten a few things, please have a look.

I can't see how you are handling entity references, which are probably the
biggest bugbear of all.

Generally, while I agree there is a requirement to do what you are
attempting, I'm not convinced this is the right architecture. My preferred
approach would be to prefilter the input document (doing some of the things
you do, and also turning entity references into PIs - except that you can't
do that if they appear in an attribute), then to do a regular
transformation, then to do a postfilter. I'm not sure that XSLT would be my
language of choice for the prefilter, though it can certainly be done [*];
but the important thing is that I think this should be a pipeline of three
transformations, not a single transformation.

[*] the reason for that is that I think the filtering should be done on a
stream of SAX events, not on raw text. Parsing the raw text reliably is just
too difficult, there are too many complexities in the XML specification.

Michael Kay

Current Thread