Skip to content

Commit b4eebec

Browse files
committed
lexer: tokenize strings on 'as' attributes of xslt instructions
- causes 'as' attribute values to use XPath syntax-highlighting - completionProvider will need fixing - xslTokenDiagnostics will need fixing
1 parent 34c5675 commit b4eebec

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

.vscodeignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ out/xslLexerRun.js
99
src/**
1010
resources/**
1111
sample/**
12+
test/**
1213
.gitignore
1314
tsconfig.json
1415
jest.config.js

src/xslLexer.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,10 +873,9 @@ export class XslLexer {
873873
attName = tokenChars.join('');
874874
let attributeNameToken = XSLTokenLevelState.attributeName;
875875
if (isNativeElement) {
876-
// if (attName === 'as') {
877-
// isXPathAttribute = true;
878-
// }
879-
if (attName === 'saxon:options') {
876+
if (attName === 'as') {
877+
isXPathAttribute = true;
878+
} else if (attName === 'saxon:options') {
880879
isXPathAttribute = true;
881880
} else if (this.genericTvtAttributes.indexOf(attName) > -1) {
882881
isXPathAttribute = false;

test/issue-144.xsl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3+
xmlns:xs="http://www.w3.org/2001/XMLSchema"
4+
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
5+
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
6+
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
7+
exclude-result-prefixes="#all"
8+
expand-text="yes"
9+
version="3.0">
10+
11+
<xsl:variable name="test1" as="xs:integer" select="1"/>
12+
<xsl:variable name="test2" as="element('books')" select="/*"/>
13+
<xsl:variable name="test3" as="map(xs:integer, map(xs:string, array(*)))" select="/*"/>
14+
15+
<xsl:template match="/*">
16+
<xsl:copy select="$test1">
17+
<xsl:attribute name="int" select="$test2"/>
18+
</xsl:copy>
19+
</xsl:template>
20+
21+
22+
</xsl:stylesheet>

0 commit comments

Comments
 (0)