[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:call-imports?

Subject: RE: xsl:call-imports?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 25 Oct 2004 18:15:01 +0100
mario caprino
It's a rational idea, but you can achieve the same effect by using a match
template with say match="*" and some special mode, and simply not using the
node that it happens to match on.

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Mario Caprino [mailto:mariocaprino@xxxxxxxxxxx] 
> Sent: 25 October 2004 17:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  xsl:call-imports?
> 
> Hi,
> 
> I'm structuring my XSLT stylesheets and find myself missing an 
> <xsl:call-imports> element.  I feel I need such an element 
> for the exact 
> same reason that <xsl:apply-imports> is so usefull.
> 
> My specific case for wanting such an element is;
> My main stylesheet includes all my default templates.  For 
> the language 
> specific versions of the stylesheet I would like to send the language 
> specific text as parameters to the default template.
> 
> Heres an example;
> 
> __default.xsl__:
> 
> <!-- main template -->
> <xsl:template match="/">
> ...
> <xsl:call-templates name="facts" />
> ...
> 
> <xsl:apply-templates />
> </xsl:template>
> 
> 
> <!-- default implementation of "facts" -->
> <xsl:template name="facts">
> <xsl:param name="h" />
> <html:div class="shadow">
> <html:div class="facts">
> <html:h2><xsl:value-of select="$h" /></html:h2>
> <html:p>...</html:p>
> </html:div>
> </html:div>
> </xsl:template>
> 
> As you see the default template contains alot of tags I would 
> like to avoid 
> copying around for each language version, and minimal 
> language specific text 
> to insert.  I would now like to write in my langugae specific 
> stylesheet the 
> following code;
> 
> 
> __en-UK.xsl__:
> 
> <xsl:import href="default.xsl" />
> 
> <xsl:template name="facts">
> <xsl:call-imports name="facts">
> </xsl:with-param name="h" select="'Did you know...'" />
> </xsl:call-imports>
> 
> But without any <xsl:call-imports> I need to find 
> alternatives to accomplish 
> this;
> 
> 1) Use template match and apply-imports instead.  In my case 
> this will not 
> work as I am creating the surrounding elements to the page 
> content, thus it 
> doesn't fit with a particular tag in the source document.
> 
> 2) Using global variables and overide those.  This gets quite 
> messy once the 
> stylesheet gets bigger.
> 
> 3) Give different names to the language specific and the 
> default template.  
> In my case it does not make sense to call the default template except 
> through the language specific template, thus it might be the best 
> suggestion.
> 
> I still feel a <xsl:call-imports> element would be the _best_ 
> solution, and 
> do not see why it is not included is XSLT.  Is it because I 
> am trying to use 
> XSLT in a inappropriate fashion?
> Am I overlooking any other alternative for solving my 
> problem?  What would 
> you do to solve the above mentioned problem?
> 
> Thank you for your help.
> 
> Best regards,
> Mario Caprino
> 
> _________________________________________________________________
> MSN Hotmail http://www.hotmail.com Med markedets beste 
> SPAM-filter. Gratis!

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.