apply-template question...

Subject: apply-template question...
From: "Mirick, John" <jmirick@xxxxxxxxxxxx>
Date: Mon, 16 Oct 2000 17:30:54 -0400
I have two XSL files for each XML file. One XSL file contains global
information the other contains page specific information. A good example of
this would be sections in a form

<!-- IN the xml file -->
<section name="empInfo">
	<header>Employee Information</header>	
	<comment>Enter employee details below</comment>
	<content>
		<input type="text" name="ssn"/>
		<input type="date" name="hireDate"/>
	</content>
</section>

The template for section, header, comment and input would all be in the
global file.... however the content template would be in the local file. The
html that is produced will be different for content part of a section,
however headers for any section will always produce the same html.

Each local xsl file always imports the global xsl file.

Now comes my question....
I want to be able to conditionally show sections within a page. Im having a
hard time figuring out how to do this...

The ideal way I think would be to override the global template in the page
specific xsl file with something like...

<!-- in the local xsl file -->
<xsl:template name="section">
	<xsl:when test="@name = 'empInfo'">
		<!-- Somehow apply the global template of section: I dont
know how. -->
	 </xsl:when>
</xsl:template>

What I want to avoid is having the same section template code in both the
local and global file... if I need to make a change as to how sections are
rendered I only want to have to worry about the global file.

On the pages where I do not need to conditionally show sections I would like
for the global template to be applied without any code in the page specific
xsl page.

Hope that made sense... Ive only been tooling around with xsl for about the
last month so there might be something obvious that im missing...

thanks,
John Paul


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


Current Thread