You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Da...@lotus.com on 2000/11/10 06:04:13 UTC
Import placement (was: Changes committed)
>Would this ["indexing" the templates] cause a problem for import
>versus include? Imported templates are all moved to the beginning of
>the imported document no matter where the xsl:import appears. Doesn't
>that mean we'd have to somehow go back and fix up the docOrderIndex for
>those templates that we parsed before hitting the xsl:import?
Remember that xsl:import can only appear at the beginning of the
stylesheet, before any xsl:include or xsl:template elements. In contrast,
xsl:template and xsl:include can be intermixed. Conceptually, every
template can be "ranked" by two parameters: the import precedence of the
file in which it appears, and its sequence order in that file. The
templates found in an included file have the same import precedence as
the including file, and their sequence order is consolidated with the
sequence of the including file. I think the interesting part is to
determine if each imported file should have an independent sequence for
its templates, and when (if ever) you need to have a grand sequence of
all the templates.
.................David Marston
Re: Import placement (was: Changes committed)
Posted by Gary L Peskin <ga...@firstech.com>.
David_Marston@lotus.com wrote:
>
> >Would this ["indexing" the templates] cause a problem for import
> >versus include? Imported templates are all moved to the beginning of
> >the imported document no matter where the xsl:import appears. Doesn't
> >that mean we'd have to somehow go back and fix up the docOrderIndex for
> >those templates that we parsed before hitting the xsl:import?
>
> Remember that xsl:import can only appear at the beginning of the
> stylesheet, before any xsl:include or xsl:template elements. In contrast,
> xsl:template and xsl:include can be intermixed. Conceptually, every
> template can be "ranked" by two parameters: the import precedence of the
> file in which it appears, and its sequence order in that file. The
> templates found in an included file have the same import precedence as
> the including file, and their sequence order is consolidated with the
> sequence of the including file. I think the interesting part is to
> determine if each imported file should have an independent sequence for
> its templates, and when (if ever) you need to have a grand sequence of
> all the templates.
> .................David Marston
David -- I agree with everything you said. It seems that, to create our
document order, then, we really have an ordered pair of numbers (import
precedence, doc order within stylesheet). For templates in included
documents, the import precedence is the same as that of the including
document. Now, what Scott had suggested was tracking the document order
in StylesheetHandler.startElement() which I guess would really be in
ProcessorImport.startElement(). I haven't looked at either one
carefully, but I guess we'd need to implement a stack which contains the
current document order. When we encounter an imported stylesheet, we
have to push an entry onto the document order tracker stack. Then,
ProcessorTemplate would need to save this ordered pair with the template
element. Then, when we're done with the imported stylesheet, we'd pop
the document order tracker stack.
We'd have to expand the code in TemplatesList which puts the templates
onto the chains so that, if match priorities are equal, we look at this
ordered pair instead of just at the document order. Should just be
another few if statements.
Not sure that you'd ever need to figure out the grand order since have
the ordered pair which is implicitly just that.
Gary