See the question and my original answer on StackOverflow

If you're using the Html Agility Pack embedded XSLT tools, you're facing two hard Html Agility Pack limits (at least with version 1.3.0.0):

  • Support for Namespaces is limited
  • The XPATH implementation does not support navigating to the attributes (only selection). This XPATH "//tag1/tag2/@myatt" does not work for example.

You can overcome these limits with C# code, but not easily with pure XPATH, hence not with XSLT.

In these case, it's often easier to convert the HTML to XML using the Html Agility Pack, and then use a regular XSLT on XML with the standard .NET classes, instead of XSLT on HTML with Html Agility Pack classes.