xsl-list
[Top] [All Lists]

Re: Getting a NodeList from a NodeList

2003-07-01 11:07:28
Generally, this cannot be done within the documented object model of the
MSXML2 namespace (MSXML4.dll).

You can *easily* do this in XSLT.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


"Allistair Crossley" <Allistair(_dot_)Crossley(_at_)qas(_dot_)com> wrote in 
message
news:5684A7E6FB10504393A2806C1F4C021017CB36(_at_)orion(_dot_)qas(_dot_)com(_dot_)(_dot_)(_dot_)
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



<Prev in Thread] Current Thread [Next in Thread>