[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Is it possible to test if a named template exists?

Subject: Is it possible to test if a named template exists?
From: "Neville Lugton" <nlugton@xxxxxxxxxxx>
Date: Tue, 05 Sep 2006 12:55:33 +0000
xslt template exists
Simplified.. I am trying to use "xsl:call-template" from an included .xsl file to insert a named template stored in the main .xsl file.

However not all the main files are going to need/have the named template. So I only want to use "xsl:call-template" if the target document has the required named template.

So far I'm working on the theory I need something like the code below:

<xsl:template match="/">
   <xsl:call-template name="insertHeader"/>
</xsl:template>

<xsl:template match="insertHeader">
   <!-- this template is included in ALL files -->
   <xsl:if test="element-available(pageScripts)">
       <xsl:call-template name="insertScripts"/>
   </xsl:if>
</xsl:template>

<xsl:template name="insertScripts">
   <!-- NOT all files have this template -->
  do things!!
</xsl:template>

Can anyone help me with what test I need for "<xsl:if test="??????">" or suggest another way to go about it all.

Regards
Neville Lugton

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.