Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

xsl:include

Former Member
0 Likes
774

I'm not entirely sure this is the right forum for this, but then, I'm not entirely sure there is a right forum for this.

I'm trying to create a few XSLT transformations in SE80. All was going well until I realised that I had the same bit of header information in each one, so I decided to split that out and put it in an include, for maintainability's sake. So here's a couple of examples:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
  <xsl:output indent="yes" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" encoding="iso-8859-1" method="xhtml"/>
  <xsl:template match="/">
    <html xml:lang="en">
      <xsl:include sap:name="ZXSL_INCLUDE"/>
      <body>
        <div/>
      </body>
    </html>
  </xsl:template>
</xsl:transform>

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
               xmlns:sap="http://www.sap.com/sapxsl"
               xmlns="http://www.w3.org/1999/xhtml"
               version="1.0">
  <xsl:output method="xml" encoding="iso-8859-1"/>
  <xsl:template match="/">
    <head>
      <title><xsl:value-of select="default/title"/></title>
      <script type="text/javascript" href="scripts.js" />
      <link rel="stylesheet" href="default.css" type="text/css" media="all"/>
      <link rel="stylesheet" href="style.css" type="text/css" media="screen"/>
      <!--[if lte IE 7]>
        <link rel="stylesheet" type="text/css" href="ie7.css" />
      <![endif]-->
      <!--[if lte IE 6]>
        <link rel="stylesheet" type="text/css" href="ie6.css" />
      <![endif]-->
    </head>
  </xsl:template>
</xsl:transform>

The content of these is not important. The important bit is thus: the '<xsl:include sap:name="ZXSL_INCLUDE"/>' is documented as being supported in SAP Note 451631 and is detailed on help.sap.com as being used as I've described, yet when you do a syntax check it says "unsupported instruction 'xsl:include'", and when you test it, it just ignores the statement.

Does anyone know (a) if I'm doing something wrong, (b) if this is actually possible and (c) if it is how to fix it?

1 ACCEPTED SOLUTION
Read only

athavanraja
Active Contributor
0 Likes
504

the reason is xsl:include cannot be inside a template move it above template it iwll be alright.

instea of

<xsl:template match="/">

<html xml:lang="en">

<xsl:include sap:name="ZXSL_INCLUDE"/>

<body>

use

<xsl:include sap:name="ZXSL_INCLUDE"/>

<xsl:template match="/">

<html xml:lang="en">

<body>

Regards

Raja

2 REPLIES 2
Read only

athavanraja
Active Contributor
0 Likes
505

the reason is xsl:include cannot be inside a template move it above template it iwll be alright.

instea of

<xsl:template match="/">

<html xml:lang="en">

<xsl:include sap:name="ZXSL_INCLUDE"/>

<body>

use

<xsl:include sap:name="ZXSL_INCLUDE"/>

<xsl:template match="/">

<html xml:lang="en">

<body>

Regards

Raja

Read only

Former Member
0 Likes
504

Thanks Durairaj, I had actually worked it out for myself, but have some points anyway seeing as technically you were the first to answer the question 😛