xsl-list
[Top] [All Lists]

[xsl] Modify some text elements copying the structure

2009-01-04 05:49:27
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

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>