Re: Subject: [xsl] creating a node-set at run-time

Subject: Re: Subject: [xsl] creating a node-set at run-time
From: Neil Smith <neil@xxxxxxxxxxxxxxx>
Date: Wed, 05 Feb 2003 10:01:30 +0000
Hi Mike - I found this example in the MSXML3 documentation, which uses the document() function in XSLT :

For the given XML document:

<employeeRefs> <employeeDoc href=""/> <employeeDoc href="localEmployees1.xml"/> <employeeDoc href="localEmployees2.xml"/> </employeeRefs>

The following style sheet generates a document containing the employee nodes in all of the referenced documents.

<xsl:stylesheet xmlns:xsl=""; version="1.0"> <xsl:template match="/"> <employees> <xsl:apply-templates select="//employeeDoc"/> </employees> </xsl:template>

<xsl:template match="employeeDoc">
    <xsl:copy-of select="document(@href)//employee"/>

Looks like exactly what you want to do :-) Cheers, Neil Smith.

At 02:30 05/02/2003 -0500, you wrote:

Date: Tue, 4 Feb 2003 21:45:48 -0600
From: "Shea, Michael" <Michael_Shea@xxxxxxx>
Subject: [xsl] creating a node-set at run-time

Hi everyone,

We have this xml as our input document:

    <item ref="item1.xml"/>
    <item ref="item2.xml"/>
    <item ref="item3.xml"/>
    <item ref="item4.xml"/>

We want to go through each of the item elements and using
the document function, load each item?.xml file and check
a specific attribute in the root node of that loaded document
to see if it matches a certain value. If it does match we want
to add the value of the ref attribute to a node-set.  We want
to have a variable to which this node-set is assigned, so we
can do some processing on it at a later time (we want to run
a diff on it against another node-set amongst other things).

Basically this is like storing items into a variable (eg
var = var + new_item), but as we know, you can't reassign values
to a variable.

So can this be done using XSLT?  I was trying to come up with a
recursive algorithm to do this, but am not sure how.

Thanks in advance.


XSL-List info and archive:

XSL-List info and archive:

Current Thread