XSLT import precedence rules not working correctly

First off, thanks, Cursor is an amazing tool.

I’m encountering issues with Cursor’s XSLT support. Specifically, Cursor is unable to resolve template references that are imported through a chain of XSLT files.

Environment

  • XSLT Version: 2.0
  • DITA-OT Version: 3.7.3
  • OS: Windows 10.0.19045

Project Structure

my-plugin/
  xsl/
    dita2html5-webhelp.xsl  (imports org.dita.html5/xsl/topic.xsl)
    topic.xsl               (extends/overrides templates)

The Problem

Cursor shows squiggly lines and errors for template calls that should be valid.

For example:

<xsl:template match="*[contains(@class, ' topic/topic ')]">
<div>
<xsl:call-template name="commonattributes"/> <!-- Error here -->
<xsl:attribute name="oid" select="@id"/>
<xsl:apply-templates/>
</div>
</xsl:template>

Error Messages

  • “XSLT: xsl:template with name ‘commonattributes’ not found”
  • “XSLT: xsl:template with name ‘setid’ not found”

These templates are actually defined in the imported org.dita.html5 plugin’s topic.xsl, but Cursor doesn’t recognize them.

Important Context

  • The templates ARE working correctly when processed by Saxon
  • The import chain is valid and works as expected during XSLT processing
  • I believe Cursor is overriding files with the same name, when it should only be overriding individual templates inside the files that have the same name
  • This is purely a Cursor linting/recognition issue

Attempted Workarounds

I’ve tried several approaches to help Cursor understand the imports:

  1. XML Catalog directive:
<!-- @cursor-xml-catalog "../../org.dita.base/catalog-dita.xml" -->
  1. Custom namespace alias:
<!-- @cursor-xslt-import-alias "ajm:import=xsl:import" -->
<!-- @cursor-xslt-namespace "http://android606.com/xsl=http://www.w3.org/1999/XSL/Transform" -->
  1. Direct template source hints:
<!-- @cursor-xslt-template-source "../../org.dita.html5/xsl/topic.xsl" -->

None of these workarounds fully resolve the issue.

Placing an xsl:import directive directly in my topic.xsl file makes the squiggly lines go away, but then it results in errors with Saxon because of the double-import and associated behavior changes.

Impact

This issue affects development workflow in several ways:

  • False positive linter errors make it harder to spot real issues
  • Reduced code navigation capabilities (can’t jump to template definitions)
  • Diminished developer experience when working with all but the simplest XSLT projects.

Expected Behavior

Cursor should:

  • Follow the XSLT import chain to resolve template references, even if it means going higher in the chain first
  • Use the @cursor-xslt-template source hints, or provide another mechanism for declaring the import chain
  • Not show false positive linter errors for valid template calls

Questions for the Team

  1. Is this a known limitation with XSLT support?
  2. Are there any other workarounds we could try?
  3. Would it be possible to enhance Cursor’s XSLT import resolution?
  4. Is this something that could potentially be resolved with an extension?

Thank you!
-Android

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.