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

Alex

0
3 comments

Hello.

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"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:nsx="nsx"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="nsx move-def.xsd">
    <xsl:output method="xml" indent="yes"/>

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

Regards,
Alexander.

0

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.

Alex

0

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 :-)

Cheers,
Sascha

0

Please sign in to leave a comment.