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!
- 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.
- Within the install directory, open the “Xml” folder, then the “Schemas” folder
- Make a copy of the existing “xslt.xsd” file therein; I renamed mine to “schema-for-xslt1.0.xsd”
- Download the official XSLT 2.0 XSD from W3C here and save it as “xslt.xsd” to the same Schemas directory above.
- If you have Visual Studio currently open, restart it.
- Once you open an XML, XSL or XSLT file, the XML menu will appear in the Toolbar:
- 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:
- The newly downloaded XSD for XSLT 2.0 should already be enabled by default but, if not, be sure to do so.
- Enjoy XSLT 2.0 IntelliSense within Visual Studio