XSL stop processing XML document after certain number of nodes



I have an xml document that looks like this:


XML



<tree>
<child>
<name>John</name>
<gender>male</gender>
<born>1854</born>
<died>1933</died>
<special>
<item>
<name>Height</name>
<value>1.92</value>
<details>meters</details>
</item>
</special>
<spouses>
<spouse>
<name>Sarah</name>
<gender>female</gender>
<born>1852</born>
<died>1928</died>
<children>
<child>
<name>David</name>
<gender>male</gender>
<born>1871</born>
<died>1951</died>
<spouses>
<spouse>
...(tree-structure) nested nodes
</spouse>
</spouses>
</child>
</children>
</spouse>
</spouses>
</child>
</tree>


The xml document is about (64kb) in size and contains about 80 generations, i wrote the following xsl file to process it and display it:


XSL



<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:output
method="html"
doctype-system="about:legacy-compat"
encoding="utf-8"
indent="yes" />
<xsl:template match="/tree/child">

<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="data.css" />
</head>
<body>
<ul>
<table>
<tr>
<xsl:call-template name="child"/>
</tr>
</table>
</ul>
</body>
</html>
</xsl:template>

<xsl:template name="child">
<td>
<xsl:choose>
<xsl:when test="name='Root'">
<p class="root"><xsl:value-of select="name"/></p>
</xsl:when>
<xsl:otherwise>
<p class="child-name"><xsl:value-of select="name"/>
<xsl:if test="gender='female'">(F)</xsl:if></p>
</xsl:otherwise>
</xsl:choose>
<ul>
<li>Born:
<xsl:call-template name="age">
<xsl:with-param name="value" select="born"/>
</xsl:call-template>
</li>
<li>Died:
<xsl:call-template name="age">
<xsl:with-param name="value" select="died"/>
</xsl:call-template>
</li>
<xsl:if test="spouses/*">
<li>Wifes:
<table>
<tr>
<xsl:for-each select="spouses/spouse">
<xsl:call-template name="spouse"/>
</xsl:for-each>
</tr>
</table>
</li>
</xsl:if>
</ul>
</td>
</xsl:template>

<xsl:template name="spouse">
<td>
<p class="spouse-name"><xsl:value-of select="name"/></p>
<xsl:if test="children/*">
<table>
<tr>
<xsl:for-each select="children/child">
<xsl:call-template name="child"/>
</xsl:for-each>
</tr>
</table>
</xsl:if>
</td>
</xsl:template>

<xsl:template name="age">
<xsl:param name="value"/>
<xsl:choose>
<xsl:when test="$value = -1">Unknow</xsl:when>
<xsl:when test="$value &lt; 0">
<xsl:value-of select="-$value"/> BCE
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$value"/> CE
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>


It works and display it properly, the only problem i'm having however is that it doesn't process any nodes after 70 recursions or so, these nodes are not getting displayed. What's causing this problem/behaviour and how can i fix it?


Thanks in advance.


No comments:

Post a Comment