HighTechTalks DotNet Forums  

Copy node values from one xml to the other (tags are removed!)

Dotnet XML microsoft.public.dotnet.xml


Discuss Copy node values from one xml to the other (tags are removed!) in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
KK
 
Posts: n/a

Default 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



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.