Page 1 of 1

XPath 3.0, simple mapping operator, and syntax highlighting

Posted: Tue May 20, 2014 7:03 pm
by Graydon2014
If I connect (for example) a group of replace functions via the simple mapping operator, the syntax highlighting goes strange.

Code: Select all


<xsl:function as="xs:string" name="d:charReplace">
<xsl:param name="inString" as="xs:string" />
<xsl:sequence
select="replace($inString,'(\p{L}s)''(\p{Zs})','$1&#x2019;$2')
!replace(.,'(\p{L})''(\p{L})','$1&#x2019;$2')
!replace(.,'''([^"'']+)''','&#x2018;$1&#x2019;')
!replace(.,'"([^"]+)"','&#x201C;$1&#x201D;')
!replace(.,'"','&#x201C;')
!replace(.,'\p{Zs}*[&#x2012;&#x2013;&#x2014;]\p{Zs}*','&#x00A0;&#x2014;&#x00A0;')
!replace(.,'([\.\?!]_?)\p{Zs}+','$1&#x0020;')
!replace(.,'\p{Zs}*\.\.\.\p{Zs}*','&#x2026;')"
/>
</xsl:function>
The first replace gets correct syntax highlighting; the second replace gets highlighted in attribute-value-brown, has the L character highlighted as though it were an element name, and things continue peculiar from there.

I was hoping 16.0 would fix this; there's a general issues with the highlighting going funny with long XPath expression, which might or might not be related to line breaks.

Re: XPath 3.0, simple mapping operator, and syntax highlight

Posted: Wed May 21, 2014 4:21 pm
by adrian
Hi,

We were not aware of this particular problem.
I can confirm that this problem is triggered by the line breaks from the XPath expression.

I have logged this to our issue tracking tool. This will be analyzed and resolved in a future version of Oxygen.

Regards,
Adrian

Re: XPath 3.0, simple mapping operator, and syntax highlight

Posted: Wed May 21, 2014 5:21 pm
by Graydon2014
adrian wrote:I have logged this to our issue tracking tool. This will be analyzed and resolved in a future version of Oxygen.
Thank you!

It would be good if the format-and-indent was aware of line breaks in long XPath expressions in attributes, too; a coding team has to be very careful about all having the exact same settings to avoid messing those up into illegibility.

Re: XPath 3.0, simple mapping operator, and syntax highlight

Posted: Thu May 22, 2014 1:07 pm
by adrian
Hi,

I tested but could not identify a format and indent problem for attributes with the default formatting options.
By default Oxygen preserves line breaks in attributes (Preferences, Editor > Format > XML ,'Preserve line breaks in attributes'), so it won't affect the line breaks from long XPath expressions that span across multiple lines.

Regards,
Adrian