XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 21st, 2004, 07:17 AM
podekerken podekerken is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 podekerken User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
unwanted invoke of xsl:template

Really don't understand this, my xsl:template is called when i don't expect it to.

I'm working on lots of xsl files, to generate preformatted letters.
These letters have many parts which should be the same allover (headers, footers etc.).

So i created a main template which gets included through xsl files to create different letters

Code:
<xsl:template name="main_1_page">
<xsl:call-template name="standaard_header" />
<xsl:call-template name="details" />
<xsl:call-template name="standaard_footer" />
</xsl:template>

Later on i made a second template.
<xsl:template name="main_two_pages" >
<xsl:call-template name="standaard_header" />
<xsl:call-template name="details" />
<xsl:call-template name="standaard_footer" />
<xsl:call-template name="header_vervolgblad">
<xsl:with-param name="vervolgblad_nr" select="1"/>
</xsl:call-template>
<xsl:call-template name="details_1"/>


An example of file to generate a letter is:
<xsl:template match="/"><xsl:call-template name="main_1_page" /></xsl:template>
<xsl:template name="details"/>


The problem is that this page tries to invoke the "details_1" template
WHY???

Thanks in advance Peter Odekerken

Reply With Quote
  #2  
Old June 22nd, 2004, 03:12 AM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
It seems to me that <xsl:call-template name="details_1"/>
is at the top level within <xsl:stylesheet> which means (if I'm not mistaken) that it will be called anyway.

I don't recommend using calls at the top level, unless you really know what you're doing. And in any case, this is something that shouldn't have to happen there. In correct programming, you'd place this as the first line of your main template if you really needed to.

Reply With Quote
  #3  
Old June 22nd, 2004, 03:28 AM
podekerken podekerken is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 podekerken User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No,

<xsl:call-template name="details_1"/>
is only called from these two templates (depending on the letter which has to be formatted):
<xsl:template name="main_1_page" >
<xsl:template name="main_two_pages" >

So the calling xsl ,simplified, looks like:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/"><xsl:call-template name="main_1_page" /></xsl:template>

<xsl:template name="details">
Detail stuff here
</xsl:template>
</xsl:stylesheet>

I could send you the files if that helps

Thanks in advance Peter Odekerken

Reply With Quote
  #4  
Old June 23rd, 2004, 04:58 AM
MarcL MarcL is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 2 MarcL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You are calling the details_1 template after you close the main_two_pages template. If you are including these templates as seperatate files then details_1 is classifed as being in the root and will always be called.

Later on i made a second template.
<xsl:template name="main_two_pages" >
<xsl:call-template name="standaard_header" />
<xsl:call-template name="details" />
<xsl:call-template name="standaard_footer" />
<xsl:call-template name="header_vervolgblad">
<xsl:with-param name="vervolgblad_nr" select="1"/>
</xsl:call-template>
<xsl:call-template name="details_1"/>

Reply With Quote
  #5  
Old June 23rd, 2004, 09:03 AM
podekerken podekerken is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 podekerken User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Appears to be that the xsl gets sort of compiled.
Meaning if it 'sees' a call:template name="the_name" it tries to find it.

I have splitted up the several main templates in different files, and that fixed the problem.
Thanks for the kind help
Peter Odekerken (obviously <xsl:newbie/>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > unwanted invoke of xsl:template


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT