I have started this again, i was trying to get my head round the basics of this and have failed, below is the structure the XML will most likely take. and then what i need to output below that...
<rtpm>
<old>
<simple>
<information>
<name1code>AAA</name1code>
<name1use>N</name1use>
<name2code>BBB</name2code>
<name2use>P</name2use>
<name3code>CCC</name3code>
<name3use>N</name3use>
<name4code>DDD</name4code>
<name4use>N</name4use>
<name5code>EEE</name5code>
<name5use>N</name5use>
</information>
</simple>
</old>
<new>
<simple>
<information>
<name1code>AAA</name1code>
<name1use>N</name1use>
<name2code>BBC</name2code>
<name2use>P</name2use>
<name3code>AFD</name3code>
<name3use>N</name3use>
<name4code>CCC</name4code>
<name4use>N</name4use>
<name5code>EEE</name5code>
<name5use>N</name5use>
</information>
</simple>
</new>
</rtpm>
I would then need this to perform what was previously described and output as
<request>
<query0>BBC</query0>
<use0>P</use0>
<query1>AFD</query1>
<use1>N</use1>
</request>
The code currently in use is as per below but i have no idea how to make it just pick up name1code, 2code etc for the old key and the use to just pick up the use value when a 'not' match is found for the code.
<xsl:key name="old" match="old/simple/information/*" use="." />
<xsl:key name="use" match="new/simple/information/*" use="name()" />
<xsl:template match="/*">
<request>
<xsl:for-each select="new/simple/information/*[not(key('old', .))]">
<xsl:element name="query{position() - 1}">
<xsl:value-of select="." />
</xsl:element>
<xsl:element name="use{position() - 1}">
<xsl:value-of select="key('use', concat(name(), 'use'))" /> <!--2-->
</xsl:element>
</xsl:for-each>
</request>
</xsl:template>
<!--2-->
is the line i can't get my head around.
Thank you too all that have helped so far, you have been a huge help. i say i have failed getting my head round it, but i get what/how this works to a degree, just not how to further it.