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

[xsl] Selecting templates by root elements from input (sub-) docs

Subject: [xsl] Selecting templates by root elements from input (sub-) docs
From: Yves Forkl <Yves.Forkl@xxxxxxx>
Date: Mon, 05 Aug 2002 22:27:58 +0200


I have several XML input documents each representing one chapter or
section (with a root element accordingly named "chapter" or "section")
of a bigger structure, so they sometimes happen to be a kind of
logical subdoc of the main input document that is currently processed.

In a rather complex stylesheet, I'm reading the content of each of
those subdoc files by using the document() function. My goal is to
process that content using a template specific to "chapter" or

As I mentionned in a previous posting with the subject "Parameter
evaluation after use of document()", I try to find the appropriate
template for the document by passing its whole content, in my
"subdoc_mode" mode specialized to that processing step. As I need the
subdoc's name when processing it, I am also passing that parameter (a
global parameter):

    <!-- hand the param to the called template -->
    <xsl:with-param name="my_subdoc"

Unfortunately, my parameter gets lost - even after passing it
explicitly like this!

>From Oleg Tkachenko's response to my posting I learnt that losing a
parameter may be related to selecting the document's root NODE instead
of its root ELEMENT - or any other element form the document -, as the
built-in template matching "/" would certainly lose it, so I added
that instruction. He also recommended:

Oleg> Try to add some location path after document() function to
Oleg> built-in templates processing as they don't pass parameters.

I tried with appending "/*" to the document() instruction, but to no
avail. Of course it would be possible to explicitly select "/chapter"
or "/section", but I think I cannot do without a generic
"apply-templates" instruction like the one above - it would thus not
be possible to state the document's root element.

Do you have any suggestions? Maybe on the general topic of processing


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

Current Thread