[xsl] Processing xsl within an included document

Subject: [xsl] Processing xsl within an included document
From: "Talley, Brooks" <brooks@xxxxxxxx>
Date: Wed, 13 Oct 2004 10:33:57 -0700
I know that this is something of a FAQ, and I apologize.  But I've
searched the list archives and googled until the "g" key on my keyboard
begged for mercy, and I'm still stuck.

I just can't get my head around processing XSL elements inside an
included document.

Here's what I've got now:

--- main.xsl ---
<xsl:variable name="testvar" select="'hello'" />
<xsl:copy-of select="document('include/header.xsl')//page/header" />
Boring main stuff

--- include/header.xsl ---
<page>
<header>
<h1><xsl:value-of select="$testvar" /></h1>
</header>
</page>

...clearly, that's not going to work because the copy-of deep copy
thing.  The <xsl:value-of...> element is just being included verbatim in
the output.

So here's where I'm stuck.  It seems like it should be a very
straightforward operation, and I've done gymnastics with <xsl:copy> and
<xsl:apply-templates/>, but I just can't seem to make it make sense.

Please advise!
-b

Current Thread