DeltaXML / vscode-xslt-tokenizer

VSCode extension for highlighting XSLT and XPath (upto 3.0/3.1)
MIT License
46 stars 4 forks source link

Attribute 'use' on xsl:context-item incorrectly marked as invalid #105

Closed jperterm closed 2 years ago

jperterm commented 2 years ago

When using the use attribute with xsl:context-item, it is highlighted as an error even though it is valid XSL. It seems like the starting quote is treated as value for use.

<xsl:template name="test">
        <xsl:context-item as="element()" use="optional"/>
        <xsl:copy-of select="current()"/>
</xsl:template>

grafik

pgfearo commented 2 years ago

Thanks for reporting this issue, I'll report back when I know more.

pgfearo commented 2 years ago

After initial investigation:

The XSLT tokeniser is at fault here. It is tokenizing the use attribute value as XPath because the 'use' attribute is an XPath expression on the xsl:key instruction. (The linter is schema-aware and is not expecting an XPath token here.)

The tokenizer must treat xsl:global-context-item and xsl:context-item elements as a special case for the 'use' attribute.

pgfearo commented 2 years ago

Linter and Auto-Complete for use attribute on xsl:global-context-item and xsl:context-item are now fixed. Awaiting release.

pgfearo commented 2 years ago

Released