xsl-list
[Top] [All Lists]

[xsl] xsl: parsing through specific child nodes

2008-09-05 13:18:08
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?

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--