xmlxslt-2.0tokenizesaxonsaxon-js

XSLT 2 Support in IntelliJ IDEA


I have a problem with viewing XSLT 2 styled XML file in IntelliJ. I've added Saxon HE dependency and I know that it works because build completes with a success (it isn't without this dependency)

Connecting to XSLT runner on localhost/127.0.0.1:62573
Connected to XSLT runner.

Process finished with exit code 0

In XSLT output I can see fully created HTML that I can put in .html file and it will work fine. The problem is when I want to see this HTML through server hosted by my application e.g. localhost:8080/sampleFile.xml. This is the problem with exactly this tag

<xsl:for-each select="tokenize(@inputDomain, ',')">
...
</xsl:for-each>

When I remove this tag, I can see the whole HTML as I want to. I think it's the problem with starting tags on those files but I don't know and I can't find any answer.

XML file starts with

<?xml version="1.0"?>
<?xml-stylesheet href="./interpreter.xsl" type="text/xsl" ?>
...

XSL file starts with

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

Solution

  • The problem is that browsers only support XSLT version 1.0 and fn:tokenize(...) is an XSLT-2.0 function. So, unfortunately, you are restricted to version 1.0 if you want to run your stylesheet in the browser.

    The only alternative would be using Saxon-JS:

    Saxon-JS is an XSLT 3.0 run-time written in pure JavaScript. It's designed to execute Stylesheet Export Files (SEFs) compiled by Saxon-EE.

    But it is not free, so you'd have to buy a license.