This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Problem with <xsl:import> and <xsl:call-template>!
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Problem with <xsl:import> and <xsl:call-template>!
- From: "Tim Watts" <timw at 3d3 dot com>
- Date: Tue, 3 Jul 2001 17:11:27 +1000
- Reply-To: xsl-list at lists dot mulberrytech dot com
An example of using call-template would be like the following
First XSL
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="document.xsl"/>
<xsl:param name="title">Page Title</xsl:param>
<xsl:template name="body">
<p>Content in here</p>
</xsl:template>
</xsl:stylesheet>
document.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*"/>
<xsl:template match="document">
<html>
<head>
<title><xsl:value-of select="$title"/></title>
</head>
<body>
<xsl:call-template name="body"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Tim Watts
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of cutlass
> I have stylesheet B importing stylesheet A ie A
> defines the PageStructure and hence all our
> stylesheets import stylesheet A.
> Stylesheet A matches the topmost node of the xml and
> generates the <HTML> and body tags.It then does an
> "apply-templates" obviously.
> Now the xml grows in size and the stylesheets get
> reused the problem is that they get applied just by
> importing for eg say i have a stylesheet that
> resuses/imports 2 stylesheets and needs to call the
> templates from those stylesheets at different
> locations/postions while formatting html.
> However they just get applied just by importing and an
> explicit call-template seems useless.The content just
> gets outputted.
using <xsl:template match="somelement"> in conjunction with
<xsl:apply-templates/> will auto match default templates.
using <xsl:template name="templatename"> in conjunction with
<xsl:call-template name="templatename"/> will only fire off that template
when u want it
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list