DavinChurch
April 5th, 2008, 11:00 AM
I've read in (via document()) two node-sets and put them in variables. Now I'd like to combine them into a single node-set (not as text or a result-tree-fragment) variable by linking them together via a key field. There's got to be an easy way to do this. My data looks something like this:
$names:
<row><col type="id">a</col><col type="name">First name</col></row>
<row><col type="id">b</col><col type="name">Second name</col></row>
<row><col type="id">c</col><col type="name">Third name</col></row>
<row><col type="id">d</col><col type="name">Forth name</col></row>
$numbers:
<row><col type="id">c</col><col type="qty">33</col></row>
<row><col type="id">a</col><col type="qty">11</col></row>
What I'd like to get back (in some form) is:
$together:
<row><col type="id">c</col><col type="name">Third name</col><col type="qty">33</col></row>
<row><col type="id">a</col><col type="name">First name</col><col type="qty">11</col></row>
Now I think I could come up with a whole stylesheet to do this job for direct translation purposes, but I'm actually needing to imbed this in a large HTML-output stylesheet (that's running off a completely different XML file) and use the resulting node-set in a for-each loop. How might I do this in some easy fashion?
(I'm running IE7 under XP, but it'd be nice if it were somewhat portable. All the XML/XSL files are local and the machine may not be web-connected when running, in case that matters for external namespaces or the like.)
$names:
<row><col type="id">a</col><col type="name">First name</col></row>
<row><col type="id">b</col><col type="name">Second name</col></row>
<row><col type="id">c</col><col type="name">Third name</col></row>
<row><col type="id">d</col><col type="name">Forth name</col></row>
$numbers:
<row><col type="id">c</col><col type="qty">33</col></row>
<row><col type="id">a</col><col type="qty">11</col></row>
What I'd like to get back (in some form) is:
$together:
<row><col type="id">c</col><col type="name">Third name</col><col type="qty">33</col></row>
<row><col type="id">a</col><col type="name">First name</col><col type="qty">11</col></row>
Now I think I could come up with a whole stylesheet to do this job for direct translation purposes, but I'm actually needing to imbed this in a large HTML-output stylesheet (that's running off a completely different XML file) and use the resulting node-set in a for-each loop. How might I do this in some easy fashion?
(I'm running IE7 under XP, but it'd be nice if it were somewhat portable. All the XML/XSL files are local and the machine may not be web-connected when running, in case that matters for external namespaces or the like.)