Skip to content
Advertisement

XSLT Error checking type of the expression ‘funcall(tokenize)’

I am trying to get the latest word in a string that is splitted with ‘/’ but for some reason I get the error

JavaScript

I know that it is only supported in xsl version 2 and I think that I have done so as can be seen in my xsl file

JavaScript

if I replace the tokenize with substring-after it does not complain about the arguments. A small xml example for the tokenize part

JavaScript

If I run my code WITH the tokenize function in this website http://xslttest.appspot.com/ it works perfectly. Not sure what I am missing here.

Not sure if it is worth noting but I run this template with the help of javax.xml.transform.TransformerFactory

UPDATE:

Ok so I replaced the Transformer to Saxon as mentioned in the comments and it catches the string now but it replaces ‘/’ with ‘ ‘ for some reason. For example if I have aa/bb/cc it returns aa bb cc

Advertisement

Answer

As Martin suggested in the comments, changing the java library to use Saxon HE version 11.4 and using [last()] did the trick

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement