简体   繁体   English

对其他扩展名(例如DITA,HTML)的文件执行intelliJ中的XSLT转换

[英]perform XSLT Transform in intelliJ on files with other extension (e.g. DITA, HTML)

As said in title, I want to be able to do XML transformation with XSLT 2.0 in intelliJ. 如标题中所述,我希望能够使用intelliJ中的XSLT 2.0进行XML转换。

  • I know IntelliJ can do transformation, but it only recognize .xml files. 我知道IntelliJ可以进行转换,但它只识别.xml文件。
  • I want to transform (in essence) XML files with .dita, or .html extension 我想(本质上)使用.dita或.html扩展名转换XML文件
  • I use Windows 7. 我使用Windows 7。

I know Oxygen can do the transformation too, but it's too expensive. 我知道氧气也可以进行改造,但它太贵了。 So that's not an option for me. 所以这不是我的选择。

Does anyone know any plugin? 有人知道任何插件吗? configuration or anyway that can make intelliJ transform on XML files with different extensions? 配置还是可以对具有不同扩展名的XML文件进行IntelliJ转换?

Intellij supports transformation with XSLT. Intellij支持使用XSLT进行转换。 It provides XSLT 1.0 transfomations out of the box, but XSLT 2.0 transformations require a bit of configuration. 它提供了开箱即用的XSLT 1.0转换,但XSLT 2.0转换需要一些配置。 The details are available on the jetbrains website here , but essentially, you have to enable the "XPathView + XSLT Support" plugin. 详情可JetBrains的网站上这里 ,但本质上,您必须启用“XPathView + XSLT支持”插件。 This plugin is bundled with Intellij and enabled by default so you should be good to go out of the box for XSLT 1.0. 此插件与Intellij捆绑在一起并默认启用,因此您应该可以开箱即用XSLT 1.0。 You can just open your stylesheet file in the editor and right click inside the file, you'll get a drop-down with one of the options being "Run .xsl" if you click this, then you can specify the source document and whether the output should go to the console or to a file and then intellij will run your stylesheet and send the output to where you chose. 您只需在编辑器中打开样式表文件,然后在文件内单击鼠标右键,就会出现一个下拉菜单,其中一个选项是“ Run .xsl”(如果您单击它),则可以指定源文档以及是否指定输出应该转到控制台或文件,然后intellij将运行样式表并将输出发送到您选择的位置。

For XSLT 2.0 the additional configuration necessary is to add an XSLT processor that supports XSLT 2.0 to the classpath. 对于XSLT 2.0,必要的附加配置是将支持XSLT 2.0的XSLT处理器添加到类路径中。 The reason you need to do this is because the XSLT processor that comes standard with the JDK is Apache Xalan and this doesn't support XSLT 2.0. 之所以需要这样做,是因为JDK随附的XSLT处理器是Apache Xalan,并且它不支持XSLT 2.0。 Saxon HE 9 is a free XSLT processor that supports XSLT 2.0. Saxon HE 9是免费的XSLT处理器,支持XSLT 2.0。 You can download the jar from the project site here and then add it to your project by opening the project structure dialog, going to the Module settings and opening the dependencies tab. 您可以从此处的项目站点下载jar,然后通过打开项目结构对话框,转到“模块设置”并打开“依赖关系”选项卡,将其添加到您的项目中。 Add the jar as a new dependency and Make sure it is at the top of the list of dependencies, above the JDK. 将jar添加为新的依赖项,并确保它位于JDK之上的依赖项列表的顶部。 Intellij will now use this XSLT processor instead of the one in the JDK to do the transformations. Intellij现在将使用此XSLT处理器而不是JDK中的处理器来进行转换。

FYI, you can also add Saxon as a dependency using maven and then it will automatically appear in the dependencies tab and you will just need to make sure to move it to the top of the list 仅供参考,您还可以使用maven将Saxon添加为依赖项,然后它会自动出现在“依赖项”选项卡中,您只需要确保将其移至列表顶部即可

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

相关问题 在XSLT中使用HTML实体(例如) - Using an HTML entity in XSLT (e.g. &nbsp;) XSLT-在定界符计数5之后包装字符串(例如5“ |”) - XSLT - Wrapping up of string after delimiter count 5 (e.g. 5 “|”) xslt两次转义(例如&amp;成为&) - xslt unescape twice (e.g. &amp;amp; to become &) XSLT无法将DITA转换为新类型 - XSLT fails to transform DITA into new type 使用XSLT拆分DITA(CALS)表-身份转换 - Splitting DITA (CALS) tables with XSLT - identity transform 如何在不使用扩展功能的情况下(例如xslt 1.0中的节点集)在包含两个字符串的结果树片段(RTF)中查找最小的字符串 - How to find smallest string in result tree fragment(RTF) containing two strings without using extension function e.g. node-set in xslt 1.0 使用 XSLT,如何增加<xsl:number> (例如'a'+1 ='b')?</xsl:number> - Using XSLT, how do I increase the value of the 'format' attribute of an <xsl:number> (e.g. 'a'+1 = 'b')? 使用XSLT制作XML(例如 <price> 10000 </price> )显示为10,000? - Using XSLT to make XML (e.g.<price>10000</price>) display as 10,000? 如何使用XSLT一次显示结果(例如,包含XML) - How do I show results one at a time using XSLT (e.g. XML included) XSLT 1.0-基于其他XML文件中的关系数据转换XML - XSLT 1.0 - Transform XML Based on Relational Data in Other XML Files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM