No template exists named:

<oXygen/> general issues.
sweetuv
Posts: 6

No template exists named:

Mon Mar 24, 2008 4:15 pm

Hi,

I have been trying to include header.xsl file in body.xsl file.

I tried both include and import. When I specifically calls the header template it is giving me out this error.

The code is here:
body.xsl

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:n2="http://irb.mit.edu/irbnamespace">
    <xsl:import href="path is here/Reports/Header.xsl" />
....
<fo:flow flow-name="xsl-region-body">             
    <xsl:call-template name="header" />  or
    <xsl:apply-templates select="header">
....


I tried include/import and call-template/apply-templates. Though apply-templates does not give this error, but no output too.

Your help is much appreciated.
sorin_ristache
Posts: 4144

Re: No template exists named:

Mon Mar 24, 2008 6:13 pm

Hello,

sweetuv wrote:

Code: Select all

<xsl:import href="path is here/Reports/Header.xsl" />


Open the stylesheet in the XSL editor of oXygen (the default editor for XSL files), place the cursor on the value of the attribute href, in your example path is here/Reports/Header.xsl, right click and select the action Open -> Open File at Caret from the popup menu. Does it open the file Header.xsl in oXygen? If it opens the file then the file exists at that location and it is imported correctly? If it does not open the file then the file does not exist at that location.


Regards,
Sorin
sweetuv
Posts: 6

Re: No template exists named:

Tue Mar 25, 2008 3:51 pm

Thank you, Sorin. The file did open in Oxygen. I am sure that the file exists in the location (I could open it in the browser also). Before this trial, I kept the header.xsl file in some other place and everything worked well. After I placed it in, one of the actual environments it is giving me this trouble.

Could not find template named: header

Do you think it might have to do something with the environment?

Thanks,
sorin_ristache
Posts: 4144

Re: No template exists named:

Tue Mar 25, 2008 4:01 pm

Hello,

In that case the problem is the missing header template. It should be defined in the main XSL file or one of the included or imported XSL files, that is your stylesheet must contain something like:

Code: Select all

<xsl:template name="header">
    ...
</xsl:template>


This is needed by the following call used in your stylesheet:

Code: Select all

<xsl:call-template name="header" />


Regards,
Sorin
sweetuv
Posts: 6

Re: No template exists named:

Tue Mar 25, 2008 4:47 pm

Thanks again.

the Header.xsl file has this:

Code: Select all

<xsl:template name="header">
....
</xsl:template>


And I have imported/included this header file in body.xsl and called the template:

Code: Select all

<xsl:include href="http://www.indiana.edu/~byourwts/xslt/Header.xsl" />
.....
<fo:flow flow-name="xsl-region-body">
 <xsl:call-template name="header" />
...
</fo:flow>


This worked perfectly fine till I had to change the location of the Header.xsl file now. (I could read the Header.xsl file from the new location as you mentioned in the previous comments)

Thanks
sorin_ristache
Posts: 4144

Re: No template exists named:

Tue Mar 25, 2008 4:54 pm

Can you send sample files for reproducing the error on our test computers? We will try to apply your sample XSL stylesheet to your sample XML document for getting the same error and telling you how to fix the error.


Regards,
Sorin
sweetuv
Posts: 6

Re: No template exists named:

Tue Mar 25, 2008 6:41 pm

Thanks Sorin. I have submitted the docs and hope something works out.
sorin_ristache
Posts: 4144

Re: No template exists named:

Tue Mar 25, 2008 7:02 pm

Hello,

Thank you for the files. As I specified in a previous post the call

Code: Select all

<xsl:call-template name="header" />


can be executed only if your stylesheet defines a template like

Code: Select all

<xsl:template name="header">
    ...
</xsl:template>


Your stylesheet includes only the following template which will not be called by the above xsl:call-template:

Code: Select all

<xsl:template match="header">
    <fo:block>
    ...
    </fo:block>
</xsl:template>


I do not know what you try to process in your stylesheet but it is an XSLT template use problem. I recommend you to read an XSLT tutorial about creating and matching template rules in XSLT. You can find good XSLT tutorials here and here.


Regards,
Sorin
sweetuv
Posts: 6

Re: No template exists named:

Tue Mar 25, 2008 7:32 pm

Thank you very much, Sorin.

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 5 guests