Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
972 views
in Technique[技术] by (71.8m points)

xml - XSLT 2.0 intellisense in Visual Studio 2010 - Adding a schema?

I want to be able to get intellisense in XSLT but for version 2.0 in visual studio

I know by default XSLT 2.0 isn't support - only 1.0 - but using Saxon API you can use XSLT 2.0.

I would love to get intellisense, i think this is possible by adding a XSLT 2.0 schema to visual studio but i am not 100% sure.

My question really is where do i get the schema from , i presume i can download it ?

and where do i install it in visual studio?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had to tweak to get VS2010 Professional to show Intellisense for XSLT 2.0. First, download the file http://www.w3.org/2007/schema-for-xslt20.xsd. You'll then need to edit the file and remove 'schemaLocation' attributes from both 'xsl:import' elements which are located at the beginning of the document after the comments. Then copy this modified file to [Your Visual Studio 10.0 Installation Folder]XmlSchemas. If you have VS running restart it. Open your XSLT file so that the XML menu is visible and goto 'XML->Schemas...'. There you will find both version 1.0 and 2.0 schemas for XSLT. You'll need to disable version 1.0 by clicking under its 'Use' field and selecting 'Don't use this scheme'. Now the Intellisense should work.

The requirement to remove 'schemaLocation' attribute may have something to do with .NET security blocking XML documents from retrieving documents from web. I'm not sure. Anyways, the files are available locally so this shouldn't be any problem.

The editor should have selected the version 2.0 of the schema by looking at <xsl:stylesheet version="2.0"...> but I'm not a XML guru so there may be a better workaround than disabling schema version 1.0.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...