Copy node values from one xml to the other (tags are removed!) -
11-07-2007
, 01:46 PM
Hi,
I have file1 that looks like this;
<A>
<user_id><xsl:value-of-select=\"A/user_id\"/></user_id>
<context>something</context>
</A>
Another file with the exist (File2)
<A>
<user_id>DATAMGR</user_id>
<user_name>DATAMGR</user_name>
</A>
After the transformation, I want File1, to look up value of <user_id/> in
File2 so the File1 and ends up with the xml;
<A>
<user_id>DATAMGR</user_id>
<context>something</context>
</A>
I am not sure how the xslt should look like. the one I used was;
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="self">
<xsl:copy>
<A>
<user_id><xsl:value-of-select=\"A/user_id\"/></user_id>
<context>something</context>
</A>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
I am new to xslt and from what I saw by browsing the net is that, I am doing
something wrong in applying the template. Seems like it uses the default
template so it gives out only the values, not the xml nodes.
Thanks for any help.
Regards
KK |