Subject: Modify some text elements copying the structure
From: "nick public" <nickpubl@xxxxxxxxx>
Date: Sun, 4 Jan 2009 11:49:00 +0100
|
Hi people.
I have the following need:
given a complicated source XML, I have to change in output the text
element for same nodes mainteinig the source structure.
An example can be this in which I want to change the <elem2> text values.
===================== SOURCE =====================
<?xml version="1.0" encoding="utf-8"?>
<root>
<level1 name="">
<elem1>element</elem1>
<level2a>
<elem2>sub element1</elem2>
</level2a>
<level2b>
<elem2>sub element2</elem2>
</level2b>
</level1>
</root>
===================== TARGET =====================
<?xml version="1.0" encoding="utf-8"?>
<root>
<level1 name="">
<elem1>element</elem1>
<level2a>
<elem2>modified element1</elem2>
</level2a>
<level2b>
<elem2>modified element2</elem2>
</level2b>
</level1>
</root>
Every since the SOURCE structure is complex, the XSLT cannot build
"manually" the TARGET structure. Should be useful copy+copy-of the
source structure in target structure and the modify the values but,
after same test, seems not possible because, when I want to operate on
copy+copy-of result-tree, this is not yet available - because in
memory too.
For me should be acceptable operate in several steps, for example,
step1 -> copy the source struct in target struct, step2 -> modify the
values.
Could you help me?
Thanks a lot and ciao.
Nicola
|