Search code examples
intellij-ideaxsltnotepad++

Why does Idea and Npp-Plugin not recognize xslt-2.0 tag?


I'm trying to setup a test environment for XSLT 2.0 on my computer. Sadly neither Intellij Ultimate nor Notepad++ with XMLTools can run this snippet, while the online transformer at freeformatter.com correctly prints the right result:

<test>aa</test>

Here is the snippet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" version="1.0" omit-xml-declaration="no" indent="yes" />
  <xsl:template match="/">
    <test>
      <xsl:analyze-string select="'aa'" regex="b">
        <xsl:non-matching-substring>
          <xsl:value-of select="." />
        </xsl:non-matching-substring>
      </xsl:analyze-string>
    </test>
  </xsl:template>
</xsl:stylesheet>

The IntelliJ-IDE at least provides a reason for failure:

[ERROR]: java.lang.RuntimeException: Nicht unterstütztes XSL-Element "http://www.w3.org/1999/XSL/Transform:analyze-string"

(which translates to "not supported XSL-ELement")

What do I miss here?

(as you can easily see, this transformation does not access XML-data, so it should print the expected result for every valid XML)


Solution

  • According to https://www.jetbrains.com/help/idea/xpath-and-xslt-support.html, Intellij Idea supports XSLT 1.0 and 2.0, but 2.0 only if you install Saxon-HE (the documentation there names 9.x but note that the XSLT world has moved on and the currently supported versions of Saxon by Saxonica are 10, 11 and 12).

    For better support of the current version XSLT 3.0 in Intellij you could also consider installing the plugin https://plugins.jetbrains.com/plugin/8612-xquery-and-xslt.