Adding XSLT 2.0 IntelliSense to Visual Studio

With the release of the CorasWorks Application Service (CAPS), the ability to leverage XSLT 2.0 within our SharePoint applications has been a major boost to our capability set. And for anyone that’s written XSLT, you know using an IDE that is schema-aware, and thus able to provide element, attribute and value completion options can make it all the easier.

As someone that works predominantly in Visual Studio, I knew there must be an option to switch the default XSLT schema from 1.0 (which is the default because that’s all native .Net supports) to 2.0. And sure enough, there is!

  1. Browse to the install directory for Visual Studio on your machine. By default this is typically “C:\Program Files\Microsoft Visual Studio XX.x” where “XX.x” is your version of Visual Studio. If you’re using a 64-bit machine, it will be the x86 version of the “Program Files” directory.
  2. Within the install directory, open the “Xml” folder, then the “Schemas” folder
  3. Make a copy of the existing “xslt.xsd” file therein; I renamed mine to “schema-for-xslt1.0.xsd”
  4. Download the official XSLT 2.0 XSD from W3C here and save it as “xslt.xsd” to the same Schemas directory above.
  5. If you have Visual Studio currently open, restart it.
  6. Once you open an XML, XSL or XSLT file, the XML menu will appear in the Toolbar:
    XML-Menu-VS
  7. Click the “Schemas…” option, which will open the XML Schemas dialog. Locate the XSD file copied in Step 3 and toggle “Use” option to Disabled:
    XSL-Schema
  8. The newly downloaded XSD for XSLT 2.0 should already be enabled by default but, if not, be sure to do so.
  9. Enjoy XSLT 2.0 IntelliSense within Visual Studio :)

Comments are closed.