Reading your message reminded me of my earlier work with XSLT. I frequently
wanted to use script functions and "loop" over nodes, but I later learned, for
the most part, that it's a lot less trouble to do things like that in XSLT
without using extension functions. If you can plainly state why you chose to
use extension functions rather than straight XSLT, you may have one of those
rare cases where this approach is justified. If you can't, you may be trying to
pound in screws with a hammer.
Show us a sample of your input and a sample of your desired output and let us
see if this can be solved more simply.
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: "Allistair Crossley" <Allistair(_dot_)Crossley(_at_)qas(_dot_)com>
Sent: Tue, 1 Jul 2003 17:16:27 +0100
To: <XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: [xsl] Getting a NodeList from a NodeList
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[(_at_)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
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list