title: Add CSS class on parent node if child node is selected
body: <p>I have a recusive-method that creates a unordered list from a XML document. To check which node I am positioned on I use the querystring to match the URL in the XML document.</p>
  
  <p>I need to add the class 'current' on the parent node if I am positioned on its child node. </p>
  
  <p>Like this:</p>
  
  <pre>
      MenuItem 1
      MenuItem 2 [class current]
           MenuItem 3 [class current] (selected node)
      MenuItem 4
  </pre>
  
  <p>My XML document is like this:</p>
  
  <pre><code>&lt;MenuItem Name="MenuItem 1" Url="MenuItem1.aspx"/&gt;
  &lt;MenuItem Name="MenuItem 2" Url="MenuItem2.aspx"&gt;
      &lt;MenuItem Name="MenuItem 3" Url="MenuItem3.aspx" /&gt;
  &lt;/MenuItem&gt;
  &lt;MenuItem Name="MenuItem4" Url="MenuItem4.asp" /&gt;
  </code></pre>
  
  <p>And my current code looks like this:</p>
  
  <pre><code>foreach (XmlNode item in menuitems)
  {
      if (HttpContext.Current.Request.Url.AbsolutePath.ToLower() == item.Attributes["Url"].Value.ToLower())
      {
          writer.AddAttribute(HtmlTextWriterAttribute.Class, "current");
      }
      writer.RenderBeginTag(HtmlTextWriterTag.Li);
      // And so on...
  }
  </code></pre>
  
  <p>So I need some kind of function to find this node and place a class on that node aswell.</p>
  
  <p>If you need more code, information or anything else - please say so! :-)</p>
  
  <p>Thank you!</p>