[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] xslt phases for FAQ, was Reading the XML declaration using XSL 2


Subject: Re: [xsl] xslt phases for FAQ, was Reading the XML declaration using XSL 2
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 20 Jan 2005 12:34:23 GMT

It isn't clear if the sub headings below

Phase 0, XML parse of stylesheet and input document:

are intended to imply chronological order of those actions.
If so the order is wrong but it's probably best not to imply any such
order as in practice they are all interleaved.

For example you have

   Expand  character references and parsed entities;
   Determine source doc encoding.

which clearly have to be done in the other order as far as the main
document is concerned. Unless you know the document encoding you can't
know that the bytes that look like "& a b c ;" do denote an ampersand an
a, a b, a c and a semicolon, so denote a reference.

External parsed entities each (can) have their own encoding declaration
so you do have to determine the encodings used there after parsing
(some of) the main document but before parsing the external entity.

You have
   URI  resolution (E.g.  Catalog management)

later in the list but clearly you can't expand external entities or
discover what encoding they are in until you have resolved the URIs that
refer to them.


Basically I think you just need the last two items

   Build the internal model of the stylesheet
       (including URI resolution if needed) by parsing the stylesheet
       including any included or imported stylesheets.
   Build the internal model of the source document (if present)
      Action document properties such as xml:space, xml:base etc
 

with a note that says that that involves some or all of the following
actions in some possibly interleaved order, and then list your other
items.

In phase 1 you end with
    Build the output tree.

but XSLT 1 and 2 are both written so that the output tree need not be
built if it is going to be followed by stage 3. You can serialise as you
go.
This is why attribute nodes can not be added after any child
elementnodes: so that you can serialse the start tag of teh parsent
before serialising teh children, you never need to backup and add new
attributes to the start tag of a parent.

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread
Keywords