XPath evaluation in Visual Studio 2010: TTXPathNavigatorVSIX

My daily tool for creating webpages is (VS2010), but one thing which I think it lacks in are XML/XSLT related tools. One such thing is related, is the one of the building blocks of XSLT which I use often during my work with Dynamicweb CMS.

I found a free addin for VS2010 TTXPathNavigatorVSIX which I tried to download. The way you should install it is by:

Open Extention Manager and Select “Online Gallery”, now type “TTXPathNavigator” in the search field. You should get something like this:

This is how the tool appears in the online gallery found under Extention Manager in your Visual studio 2010

Now click “Download” and after having accepted something the plugin is installed into your VS2010. You must restart VS2010 in order to make the plugin work, so do that. You simply press restart.

Using the plugin

After VS2010 has restarted you now have a new XPath query field as shown here below.

This is a screenshoot taken by the tool creator

So off you go! XPathing away! Happy XPathing…

Or so I though.. I might have guessed by the lacking documentation on the page where I initially found the plugin, that I needed to do some trying out before I could start to use this very simple plugin. So to save your time here is what I found out:

  • Before using it you should know that it is a simple plugin:
    - no highlighting of XPath results in the XML tree
    - results are only presented in the output window. So you need to open (and pin) the output window. So open the debug window and pin it (so that it stays open)

    You find the debug window under Debug - Windows - Output

  • In the output window you wil have to select to see the output from XPath navigator, and you might have to execute a XPath navigator before the option is there in the “Show output from” selectbox.

    image

  • It only handles results which return a node-set, which is, well a limitation IMHO. What this means is that you cannot get a result from say this XPath:
    count(//Page[string-length(@Icon)>0])
  • The good news!
    You can actually double click on the output to goto the line containing the found element! Very nice!

My wish – an XPath generator!

To make things work perfectect in VS2010 it would be so nice to have a XPath generator! As you have when you debug XSLT in the watch area. I would love to be able to select an element or an attribute and right click to get the option: “Generate XPath” – wow, please someone create such a plugin and I will buy you a beer! Smiley

US