Project

Profile

Help

Bug #5667

closed

ixsl:eval argument starting with a newline fails to evaluate

Added by Martynas Jusevicius 3 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
Start date:
2022-08-30
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
2, Trunk
Fix Committed on JS Branch:
2, Trunk
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

<xsl:variable name="js-statement" as="xs:string"><![CDATA[(function isString (item) { return typeof item == 'string'})]]></xsl:variable>
<xsl:variable name="js-function" select="ixsl:eval($js-statement)"/>
<xsl:value-of select="exists($js-function)"/>

returns true

<xsl:variable name="js-statement" as="xs:string"><![CDATA[
(function isString (item) { return typeof item == 'string'})]]></xsl:variable>
<xsl:variable name="js-function" select="ixsl:eval($js-statement)"/>
<xsl:value-of select="exists($js-function)"/>

returns false

<xsl:variable name="js-statement" as="xs:string"><![CDATA[
(function isString (item) { return typeof item == 'string'})]]></xsl:variable>
<xsl:variable name="js-function" select="ixsl:eval(normalize-space($js-statement))"/>
<xsl:value-of select="exists($js-function)"/>

returns true (note normalize-space())

Actions #1

Updated by Norm Tovey-Walsh 3 months ago

  • Sprint/Milestone set to SaxonJS 2.5
Actions #2

Updated by Norm Tovey-Walsh 3 months ago

Sometimes (narrator voice: often), when I learn new things about JavaScript, I just want to cry.

Consider:

function f1() {
   return 3+4
}

If you call f1(), it will return 7.

Now consider:

function f2() {
   return
   3+4
}

If you call f2(), it will return [checks notes] nothing.

The expression 3+4 is unreachable code.

Luckily, this works:

function f2() {
   return (
   3+4)
}
Actions #3

Updated by Norm Tovey-Walsh 3 months ago

  • Status changed from New to Resolved
  • Applies to JS Branch 2, Trunk added
  • Fix Committed on JS Branch 2, Trunk added
Actions #4

Updated by Michael Kay 3 months ago

I'll try to remember that, but will almost certainly fail.

Actions #5

Updated by Norm Tovey-Walsh about 2 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in JS Release set to SaxonJS 2.5

Fixed in SaxonJS 2.5.

Please register to edit this issue

Also available in: Atom PDF Tracking page