[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Convert apply-templates to call-template?
Subject: [xsl] Convert apply-templates to call-template?
From: Phillip B Oldham <phillip.oldham@xxxxxxxxxx>
Date: Mon, 30 Jan 2006 08:11:34 +0000
|
Hi all
Someone kindly gave me the following stylesheet to reproduce a SQL BTree in XML nodes. I'm having a problem, however, and need to convert the template to act on <xsl:call-template /> rather than <xsl:apply-templates />. Can someone help me convert it? I've tried, but I just end up with 500 errors from PHP5.
:::::
<?xml version="1.0" encoding="utf8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf8" indent="yes"/>
<!-- Conditions equivalent to
<xsl:sequence select="$boss/../item[lh gt $boss/lh and rh le $boss/rh]"/>
-->
<xsl:template match="item">
<xsl:param name="context"/>
<xsl:if test="not($context[current()/lh > lh and rh >= current()/rh])">
<xsl:variable name="context-inner"
select="$context[lh > current()/lh and current()/rh >= rh]"/>
<department title="{name}">
<xsl:apply-templates select="$context-inner">
<xsl:with-param name="context" select="$context-inner"/>
</xsl:apply-templates>
</department>
</xsl:if>
</xsl:template>
<xsl:template match="/">
<group>
<xsl:apply-templates select="output/item">
<xsl:with-param name="context" select="output/item"/>
</xsl:apply-templates>
</group>
</xsl:template>
</xsl:stylesheet>
|