Martin Honnen wrote:
Quote:
Richard Tobin wrote:
>
Quote:
In article <44eb096f$0$10167$9b4e6d93@newsspool1.arcor-online.net>,
Martin Honnen <Martin.Honnen@gmx.dewrote:
Quote:
>I see no way then but hardcoding the different cases e.g.
>
Quote:
You could use a table.
>
Quote:
<x:new name="AAA" value="aNewValue1"/>
<x:new name="BBB" value="aNewValue2"/>
>
Yes, Philippe has already suggested the same approach. Nevertheless you
have to hardcode the different cases in the stylesheet as there seemed
to be no way to infer the new value from the old one.
>
>
--
>
Martin Honnen
http://JavaScript.FAQTs.com/ Thanks a lot to everyone!
the hard-coded solution works fine and is enough for what I need at
this time; also the associative table solution is very valuable and
I'll add it to my toolbox for the future... when I'll be more
proficient with XSLT ;-)
I've only another quick question
Is it possible to remove one or more elements according to the value of
an element's attribute; i.e. given the following source XML file:
<?xml version="1.0" encoding="UTF-8"?>
<sample xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNameSpaceSchemaLocation="sample.xsd">
<parent-element>
<child-element name="AAA" value="XXX"/>
<child-element name="BBB" value="XXX"/>
<child-element name="CCC" value="XXX"/>
<additional-data type="text"/>
<additional-info type="text"/>
</parent-element>
</sample>
is it possible, changing somewhat the last leg to the above IF - ELSE
IF switch:
...
ELESE IF name = 'CCC' THEN {
value = aNewValue3
remove elements additional-data and additional-info type
}
to obtain the following result:
<?xml version="1.0" encoding="UTF-8"?>
<sample xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNameSpaceSchemaLocation="sample.xsd">
<parent-element>
<child-element name="AAA" value="aNewValue1"/>
<child-element name="BBB" value="aNewValue2"/>
<child-element name="CCC" value="aNewValue3"/>
</parent-element>
</sample>
Thanks again for all your support
Regards,
Patrizio