RE: [xsl] Newbie question on Recusrion using XLST 1.0

Subject: RE: [xsl] Newbie question on Recusrion using XLST 1.0
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 30 Apr 2005 14:12:53 +0100
>        I have an example file with the following structure:
> 
> <company>
>    <division DID="Sal">
>       <employees>
> 		<employee EID="EMP001">
> 
> Here is my code so far
> 
> <xsl:variable name="result">
>   <xsl:call-template name="DisplayEmployees">
> 	<xsl:with-param name="employeeList" select="company/division"/>
>   </xsl:call-template>
> </xsl:variable>	
> <xsl:value-of select="$result"/>

The fact that you are using the select expression company/division suggests
that at the point where this variable is declared, the context node is the
root node of the document. (Perhaps it's even a global variable, who knows?)
However, in the code below, you test		

> 	<xsl:when test="employees/employee[@EID]">

without having changed the context node. If company/division selects
anything, then employees/employee won't. I suspect you meant to write
$employeeList/employees/employee - but I haven't checked whether that would
fix the problem.

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

Current Thread