[xsl] Getting a NodeList from a NodeList

Subject: [xsl] Getting a NodeList from a NodeList
From: "Allistair Crossley" <Allistair.Crossley@xxxxxxx>
Date: Tue, 1 Jul 2003 17:16:27 +0100
Hi 

I am using XSL and MSXML 4 to do some reports. I have a main body of XSL which selects from an XML tree all employees who belong to a particular department which is a list being looped over already. The current department value is stored in $deptName

<xsl:for-each select="mycomp:getFilteredEmployeeRecords(//employee[./@department = $deptName])"> 

Here, I am passing the result of "all employees in the current department" to a MSXSL:SCRIPT function where I want to filter the node list even more and return it. 

Let's say I want a node list of all employees called John from the node list that I pass into the function to come out.

My problem is that nodeList is a DOMNodeList and does not have what I need to select another nodeList from it...i.e Node's selectNodes. All it has is the ability to get a node. 

I want to do something like

function getEmployeeRecords(nodeList) { 
return nodeList.selectNodes("/employee[@name='John']"); 
} 

The problem is that nodeList is a list of EMPLOYEE nodes. 

How can I return a nodeList from my function which is all EMPLOYEE nodes in nodeList with name = John?

I have thought about sibling functions but I am not sure.

Allistair Crossley 
Senior Intranet Developer
QAS Ltd 
Direct Dial: 020 7819 5343 



<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com";>www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread