I’m trying to set the value of all “CSS” elements “value” to “”, here is the code:
XDocument doc = XDocument.Load(fi.FullName);
XNamespace rep = "http://developer.cognos.com/schemas/report/8.0/";
List<XElement> cssElements =
(from e in doc.Root.DescendantsAndSelf(rep + "CSS")
where
(
(e.Attribute("value") != null)
)
select e).ToList();
//modify Attribute in elements
foreach (XElement xe in cssElements)
{
xe.Attribute("value").Value = "";
}
But, I don’t want to modify this one CSS, which has as ancestors “crosstab” and “style” (xml below):
<crosstab name="Crosstab1" refQuery="Query1">
<crosstabSuppress type="rows"/>
<style>
<CSS value="border-collapse:collapse;font-family:'Times New Roman'"/>
how can I do that? Thanks!
If I understood you correctly, maybe something like this:
I only added this to your
where-clause: