Way to tell IntelliJ about custom XPath functions?

Is there a way to tell IntelliJ about custom XPath functions, so:

1. it doesn't "complain" about the function being unknown
2. it provides code completion, shows the signature, etc when editing the XPath expression


Comment actions Permalink


Not sure about completion and doc: probably new feature is required.

Regarding highlighting: in the following dummy sample my custom function is green, providing the namespace definition is green. Does this case help?

<xsl:stylesheet version="2.0"
                xsi:schemaLocation="nsx move-def.xsd">
    <xsl:output method="xml" indent="yes"/>

    <xsl:template match="/">
        <xsl:value-of select="nsx:custom-function()"/>


Comment actions Permalink

Hi Alexander,

I am using language injections to tell IntelliJ that the value of certain attributes is XPath. In XSLT, function in namespaces are not highlighted, but with an injection they are:

Screen Shot 2013-05-31 at 6.03.02 PM.png

Plus, I also have functions with no namespace (e.g. when writing XForms, functions defined by that spec, such as instance()). It would be lovely if we could define those functions somewhere, just like we can define custom elements, attributes… in a schema.


Comment actions Permalink

Hi Alex,

currently there is no way to define custom XPath functions for this use-case. Right now the only way is to write a plugin that extends the XPath plugin and provides an appropriate context with all available additional functions. However, this could be implemented in the future - a YouTrack issue is welcome :-)



Please sign in to leave a comment.