Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 31st, 2004, 09:01 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT Stack overflow

Hi all!

I've the problem that I don't know how to handle with templates so that I can call a template into another (e.g. I tried to get a table into a parent table) without getting a Stack overflow

XML:
<table>
<border>5</border>
<width>50%</width>
<cellspacing>2</cellspacing>
<tr>
<td>
<width>30%</width>
<colspan>1</colspan>
<text>1.Feld</text>
</td>
<td>
<width>40%</width>
<colspan>1</colspan>
<text>2.Feld</text>
</td>
<td>
<width>40%</width>
<colspan>1</colspan>
<text></text>
</td>
<td>

<table>
<border>5</border>
<width>25%</width>
<cellspacing>2</cellspacing>
<tr>
<td>
<width>30%</width>
<colspan>1</colspan>
<text>11.Feld</text>
</td>
<td>
<width>40%</width>
<colspan>1</colspan>
<text>22.Feld</text>
</td>
</tr>
<tr>
<td>
<width>30%</width>
<colspan>3</colspan>
<text>ganz viele Fehler<text>
</td>
</tr>
</table>
</td>
</tr>
</table>

XSL:

<xsl:template match="table">
<table border="{border}" width="{width}" cellspacing="{cellspacing}">
<xsl:for-each select="tr">
<xsl:value-of select="rowspan"/><tr rowspan="{rowspan}">
<xsl:for-each select="td">
<td width="{width}" colspan="{colspan}">
<xsl:value-of select="text"/>

<xsl:apply-templates select="//table"/>
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</xsl:template>

Reply With Quote
  #2 (permalink)  
Old August 31st, 2004, 09:53 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I don't know what you're trying to achieve here, but what your code actually does is that every time you process a table element (xsl:template match="table") you are asking it to process every table element in the whole document (xsl:apply-templates select="//table") including of course the table where you started. So this will give you infinite recursion (or it would, if the processor had an infinite stack).



Michael Kay
http://saxon.sf.net/
Reply With Quote
  #3 (permalink)  
Old September 1st, 2004, 12:59 AM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, for your response

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stack Overflow Exception?? Apocolypse2005 Visual Basic 2005 Basics 2 January 17th, 2008 07:06 PM
Recursive algorithm causing stack overflow rharris VB.NET 2002/2003 Basics 8 July 7th, 2005 12:48 PM
Resursive algorithm causing stack overflow rharris Pro VB.NET 2002/2003 1 July 4th, 2005 11:00 AM
Recursive algorithm causing stack overflow rharris VB.NET 1 July 4th, 2005 10:57 AM
C++ Stack? Spivonious C++ Programming 6 October 11th, 2004 03:56 AM



All times are GMT -4. The time now is 08:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.