[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] creating a node-set at run-time
From: "Ross Ken" <Ken.Ross@xxxxxxxxxxxxxx>
Date: Wed, 5 Feb 2003 14:09:35 +1000

Untested but how about

<xsl:param name="var">
	<xsl:for-each select="list/item[@ref]">
		<xsl:copy-of select="document(@ref)/root[@attrib='attrib-val']"/>
	</xsl:for-each>
</xsl:param>

Ken Ross
Ph: +61 7 32359370
Mob: +61 (0)419 772299
Email: Ken.Ross@xxxxxxxxxxxxxx


-----Original Message-----
From: Shea, Michael [mailto:Michael_Shea@xxxxxxx]
Sent: Wednesday, 5 February 2003 1:46 PM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] creating a node-set at run-time


Hi everyone,

We have this xml as our input document:

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

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.

Mike.

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

IMPORTANT: This email (including any attachments) may contain confidential,
private or legally privileged information and may be protected by copyright. You may
only use it if you are the person(s) it was intended to be sent to and if you use it in an
authorised way. No one is allowed to use, review, alter, transmit, disclose, distribute,
print or copy this e-mail without appropriate authority.
 
If this e-mail was not intended for you and was sent to you by mistake, please
telephone or e-mail me immediately, destroy any hard copies of this e-mail and delete
it and any copies of it from your computer system. Any legal privilege and 
confidentiality attached to this e-mail is not waived or destroyed by that mistake.
 
It is your responsibility to ensure that this e-mail does not contain and is not affected
by computer viruses, defects or interference by third parties or replication problems
(including incompatibility with your computer system).




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



Current Thread
Keywords