Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSL Template Question

From: "George Bina" <george@---------.--->
To: NULL
Date: 7/12/2006 1:02:00 AM

Hi,

Those are named templates that do nothing when you call them.
They can be overwritten in a stylesheet that imports that stylesheet.

For instance if you have

a.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  <xsl:template name="a">in a</xsl:template>
</xsl:stylesheet>


and test.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">
  <xsl:import href="a.xsl"/>
  <xsl:template match="/">
    <xsl:call-template name="a"/>
  </xsl:template>
</xsl:stylesheet>

you will get "in a" as output.

But if you add an a template in test.xsl
<xsl:template name="a">a in test.xsl</xsl:template>
then you will get as output "a in test.xsl".

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com

Brill2 wrote:
> Dear Guru's, please forgive the newbie question but I have a problem I
> can't seem to figure out.  I am supporting some old XSLT code and I see
> the following code everywhere :
>
>                <xsl:template name="left"/>
> 	<xsl:template name="middle">
> 		<xsl:call-template name="lixwelcom"/>
> 		<xsl:call-template name="lixlatnws"/>
> 		<xsl:call-template name="lislstreq"/>
> 		<xsl:if test="not($sec:group[@loc:id = 'LIBRARYSTAFF'])">
> 			<xsl:call-template name="lislstsub"/>
> 		</xsl:if>
> 	</xsl:template>
> 	<xsl:template name="right"/>
> 	<xsl:include href="../core/lixwelcom.xsl"/>
> 	<xsl:include href="../nws/lixlatnws.xsl"/>
> 	<xsl:include href="../req/lislstreq.xsl"/>
> 	<xsl:include href="../sub/lislstsub.xsl"/>
> 	<xsl:include href="../default.xsl"/>
>
> My problem is with the tags named :
> <xsl:template name="left"/>
> <xsl:template name="right"/>
>
> I understand what the tag <xsl:template name="middle"> is doing because
> it is defined, however the tags left and right are confusing the heck
> outta me.  I don't understand, if a template is undefined like that is
> it legal?  Or am I reading the syntax wrong and are these tags actually
> calling a template somewhere named left and right?
>
> Are they just placeholders?
>
> I really cant get my brain around this one.  Any help would be
> appreciated and maybe an explanation as to why someone would use xslt
> in this way.
> 
> Again thank you for your help
> Regards



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent