how do I eliminate elements with certain Ancestors?

Rin

New Member
I'm trying to set the value of all "CSS" elements "value" to "", here is the code:\[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 elementsforeach (XElement xe in cssElements){ xe.Attribute("value").Valuehttp://stackoverflow.com/questions/10435172/= "";}\[/code\]But, I don't want to modify this one CSS, which has as ancestors "crosstab" and "style" (xml below):\[code\]<crosstab name="Crosstab1" refQuery="Query1"><crosstabSuppress type="rows"/><style> <CSS value="http://stackoverflow.com/questions/10435172/border-collapse:collapse;font-family:'Times New Roman'"/> \[/code\]how can I do that? Thanks!
 
Back
Top