Hi, my problem is the following: How can I remove selected ChildNodes from XmlNode recursively? My XML-file looks like...
..<element type="TextBox" id="xslFilePath">
<parameters>
<parameter id="description">
<value><![CDATA[Pfad zur XSL]]></value>
<value lang="en"><![CDATA[XSL-file's path]]></value>
</parameter>
<parameter id="tooltip">
<value><![CDATA[Pfad zur XSL]]></value>
<value lang="en"><![CDATA[XSL-file's path]]></value>
</parameter>
</parameters>
<values>
<value><![CDATA[/include/extensions/languageReferences/xsl/default.xsl]]></value>
</values>
</element>
<element type="DropDownList" id="imageOrientation">
<parameters>
<parameter id="description">
<value><![CDATA[Anordnung]]></value>
<value lang="en"><![CDATA[Orientation]]></value>
</parameter>
<parameter id="tooltip">
<value><![CDATA[Anordnung]]></value>
<value lang="en"><![CDATA[Orientation]]></value>
</parameter>
</parameters>
<items>
<item id="" selected="true">
<parameters>
<parameter id="value">
<value><![CDATA[vertical]]></value>
</parameter>
<parameter id="description">
<value><![CDATA[senkrecht]]></value>
<value lang="en"><![CDATA[vertical]]></value>
</parameter>
</parameters>
</item>
<item id="" selected="false">
<parameters>
<parameter id="value">
<value><![CDATA[horizontal]]></value>
</parameter>
<parameter id="description">
<value><![CDATA[waagerecht]]></value>
<value lang="en"><![CDATA[horizontal]]></value>
</parameter>
</parameters>
</item>
</items>
<values>
<value><![CDATA[horizontal]]></value>
</values>
</element>...
I would like to remove all nodes (type of value) where the parentNode is type of parameter with id="description" but not value-notes as children of values or parameter with id="value" In XSLT I would say e.g.: //value[parent::parameter[@id='description'] and @lang='en']
The problem is: I have the language code: e.g. "de" and now I would like to remove all sibling value nodes if an value with lang="de" exists and remove all sibling nodes excluding the value without any lang-attribute if lang="de" not exists (as fallback) I hope, you can help me to write an c# Code to replace recursively all undesired value-nodes.