Solved

Invalid instantiation of 'xsl:include' in 'xsl:template' context

Posted on 2004-09-08
2
754 Views
Last Modified: 2008-02-01

this is my xsl;

i am want to put the code from starting block to  ending block into different xsl like footer.xsl;


can i write like this <xsl:include href="footer.xsl"/>


i am including like this <xsl:include href="footer.xsl"/> in place of the block of code
but i am getting error

XSL-1047: (Error) Invalid instantiation of 'xsl:include' in 'xsl:template' context.


<?xml version="1.0" ?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" />
  <xsl:param name="recordsPerPage" select="5" />
  <xsl:param name="pageNumber" select="page/request/parameters/pageNumber" />
  <xsl:param name="recordCount" select="count(//ROW)" />
  <xsl:param name="Operation" select="page/request/parameters/operation" />

 <xsl:template match="page">
  <center><h3><font face='verdana'>Consol Details</font></h3></center>
 <table cellSpacing='0' cellpadding='0'  width='95%'>
 <center>
<THEAD>
 <tr CLASS="formheader">
 <td></td>
      <td onclick="callSorting(this.id);" id="tdConsole"><u>C</u>onsol No</td>
      <td onclick="callSorting(this.id);" id="tdMAWB"><u>M</u>AWB No</td>
      <td onclick="callSorting(this.id);" id="tdOrigin"><u>O</u>rigin</td>
      <td onclick="callSorting(this.id);" id="tdDestination"><u>D</u>estination</td>
      <td onclick="callSorting(this.id);" id="tdAirline"><u>A</u>irline</td>
      <td onclick="callSorting(this.id);" id="tdFlight"><u>F</u>light</td>
      <td onclick="callSorting(this.id);" id="tdETD"><u> E</u>TD</td>
      <td onclick="callSorting(this.id);" id="tdETA"> E<u>T</u>A</td>
      <td onclick="callSorting(this.id);" id="tdCutOffDate"> C<u>u</u>t Off Date</td>
  </tr>
</THEAD>

 <xsl:for-each select="ROWSET/ROW">
 
 <tr id='tr{position()-1}'  class="formdata">
  <td id='refTD{position()-1}' console='{CONSOLEID}'>
  <input name='console' type='radio' value='refTD{position()-1}'>
  <xsl:attribute name ="onClick">highLight('tr<xsl:value-of select="position()-1"/>')</xsl:attribute>
  <xsl:attribute name ="onDblClick">setId('refTD<xsl:value-of select="position()-1"/>')</xsl:attribute>
  </input>
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="CONSOLEID" />
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="MASTERDOCID" />
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="ORIGIN" />
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="DESTINATION" />
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="CARRIERID" />
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="FLIGHT_NO" />
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="ETD" />
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="ETA" />
  </td>
 <td id='refTD{position()-1}'>
  <xsl:value-of select="CUTOFF_DATE" />
  </td>
  </tr>
  </xsl:for-each>
  </center>
  </table>

<!-------------------- starting --------------------->
  <table cellSpacing="0" cellpadding="0" border="1" width="95%">
 <tr class="formdata">
 <td width="15%" style="font-size:8pt;">
 <xsl:if test="$pageNumber > 0">
 <xsl:element name="a">
 <xsl:attribute name="href">ETCLOVConsoleIds1.jsp?pagenumber=<xsl:value-of select="number($pageNumber)-1" />
  </xsl:attribute>
  HAWBNO  
  </xsl:element>
  </xsl:if>
  </td>
  </tr>
  </table>
<!-------------------- ending  --------------------->

<br/>
<br/>
<center>
<input type="button" value="Ok" name="Ok" id="Ok" onClick="setId()" class="input"/>
&nbsp;<input type="button" value="Cancel" name="Cancel" id="Cancel" onClick="resetValues();" class="input"/>
</center>
  </xsl:template>
  </xsl:stylesheet>
0
Comment
Question by:chaitu chaitu
  • 2
2 Comments
 
LVL 19

Expert Comment

by:ramazanyich
ID: 12004199
The xsl:include element is only allowed as a top-level element.
0
 
LVL 19

Accepted Solution

by:
ramazanyich earned 300 total points
ID: 12004212
to solve your problem you should cretate template in your footer.xsl and call it from your main template:

footer.xsl:

<xsl:template name="footer">
do-some-staff
</xsl:template>

in your main xsl file:
<xsl:stylesheet>
<xsl:include href="footer.xsl"/>

<xsl:tempate match="/">
<!--do main staff-->
<!-- now include your footer>
<xsl:call-template name="footer"/>
</xsl:template>

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now