Re: [xsl] xsl:include blues..

Subject: Re: [xsl] xsl:include blues..
From: Oliver Becker <obecker@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Feb 2001 10:38:46 +0100 (MET)
Hi Kevin,

yes, your XSLT must be well-formed XML. So you can't seperate opening
and closing tags. You have to create them together (strictly spoken:
you create an element).

This can be done by using a named template:

<xsl:template name="frame">
  <xsl:param name="content" />
      <xsl:copy-of select="$content" />

<xsl:include file="include.xsl"/>

<xsl:template match="ob">
  <xsl:call-template name="frame">
    <xsl:with-param name="content">
      ... some HTML


You wrote:
> I am having two dilemas with using an XSL include. First, I want to include
> a "header" and "footer" on every page. The header would be the opening HTML
> (<html><head></head><body>), and the footer would be the closing
> </body></html>. I thought of putting these in a "library" of templates, so
> that I can match a <header> and <footer> tag in the source XML, but
> apparently you have to close the tags you open even in a template. I figure
> the resulting XML had to be well-formed. For example, here is a snippet of
> xsl I thought would work:
> -----------
> include.xsl
> -----------
> <xsl:template match="header">
>   <html>
>     <head>
>     </head>
>     <body>
> </xsl:template>
> <xsl:template match="footer">
>     </body>
>   </html>
> </xsl:template>
> ------------
> somepage.xsl
> ------------
> <xsl:include file="include.xsl"/>
> <xsl:template match="ob">
>   <xsl:apply-templates select="header"/>
>     ... some HTML
>   <xsl:apply-templates select="footer"/>
> </xsl:template>
> I am not sure why the above doesn't work, but I assume its because the
> templates must be well-formed? So the question is, how can I include the
> same "header" and "footer" in every XSL page so that I can use a consistent
> look to my site, but still get the benefits of using XSL?


|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@xxxxxxxxxxxxxxxxxxxxxxx             |
|  op|qo        WWW: |

 XSL-List info and archive:

Current Thread