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

[xsl] xsl: parsing through specific child nodes


Subject: [xsl] xsl: parsing through specific child nodes
From: "Mohit Anchlia" <mohitanchlia@xxxxxxxxx>
Date: Fri, 5 Sep 2008 10:17:44 -0700

I need to change only certain child nodes to certain values. Could somebody
tell me how to do that. I have 2 xml docs and I need to parse through both
and change only certain nodes. I'll explain with an eg:

XML 1:
<ZZ>
<ABC>XXXXX<ABC>
<DEF>YYYYYY<DEF>
<ZZ>

XML 2:
:
<ZZ>
<ABC>AAAAA<ABC>
<DEF>FFFFFFF<DEF>
<ZZ>

So when I am merging I need to check if <DEF> has YYYYY then change it to
DDDDD, or if <DEF> has GGGGGG then change it to EEEEEE. Values are known
upfront so that means mapping could be hard coded within "if" statement. So
after the 2 docs get merged it should look like.

<Body>
<ZZ>
<ABC>XXXXX<ABC>
<DEF>DDDDD<DEF>
<ZZ>
<ZZ>
<ABC>AAAAA<ABC>
<DEF>FFFFFFF<DEF>
<ZZ>
</Body>
--
one more question, for above scenario should I be using xsl:key for
mapping purposes. for eg: If I want to change value from A to B for
certain node types?


Current Thread
Keywords
xml