简体   繁体   English

如何在visual studio环境中使用EXSLT

[英]How to use EXSLT in visual studio environment

is it possible to use EXSLT functions within Visual Studio? 是否可以在Visual Studio中使用EXSLT函数? I write and debug my xslt scripts in VS. 我在VS中编写和调试我的xslt脚本。 What I have to do to be able to use eg date:add() function? 我需要做些什么才能使用例如date:add()函数? What a very simple script should look like? 一个非常简单的脚本应该是什么样子? Thanks a lot, petr 非常感谢,皮特

The latest three versions of Visual Studio (2010, 2008 and 2005) all use the .NET XslCompiledTransform XSLT processor . Visual Studio(2010,2008和2005)的最新三个版本都使用.NET XslCompiledTransform XSLT处理器 XslCompiledTransform does not implement any EXSLT function except common:node-set() -- so here you are out of luck. 除了common:node-set()之外,XslCompiledTransform没有实现任何EXSLT函数 - 所以在这里你运气不好。

I don't think there is an easy and natural way to use other XSLT processors in Visual Studio, and even there could be some trick to do this, one wouldn't be able to do XSLT debugging in this case. 我不认为在Visual Studio中使用其他XSLT处理器有一种简单而自然的方法,即使可能有一些技巧,在这种情况下也无法进行XSLT调试。

Finally, EXSLT usually provides a limited XSLT implementation of some of the EXSLT functions. 最后,EXSLT通常提供一些EXSLT函数的有限XSLT实现。 This is much less powerful and convenient, of course, but you could go that route. 当然,这不那么强大和方便,但你可以走那条路。

My personal recommendation is to start using XSLT 2.0 , which is so much more powerful than XSLT 1.0 that there is very little need to use EXSLT in an XSLT 2.0 application. 我个人的建议是开始使用XSLT 2.0 ,它比XSLT 1.0强大得多,因此很少需要在XSLT 2.0应用程序中使用EXSLT。

Of course, there is no support for XSLT 2.0 in VS, but there are other excellent IDEs such as oXygen, that among other things provide good XSLT 2.0 and XQuery debuggers. 当然,VS中没有对XSLT 2.0的支持,但是还有其他优秀的IDE,比如oXygen,除此之外还提供了很好的XSLT 2.0和XQuery调试器。

Update : You can use a 3rd party implementation of EXSLT for XslCompiledTransform: the MVP - XML project's EXSLT .NET module . 更新 :您可以使用EXSLT的第三方实现来实现XslCompiledTransform: MVP-XML项目的EXSLT .NET模块

You can also use the msxml:script tag to include your own functions in the XSLT. 您还可以使用msxml:script标记在XSLT中包含您自己的函数。 This works fine for simple functions, and can also be debugged in VS2005 and above, eg 这适用于简单的功能,也可以在VS2005及更高版本中调试,例如

<msxml:script implements-prefix="user">
  <![CDATA[ 
  function toUpperCase(str)
  {
    return str.toUpperCase();
  }
  ]]>
</msxml:script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM