Project

Profile

Help

Bug #5031

ixsl:set-property: ... not found for supplied object

Added by Martynas Jusevicius 3 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Low
Category:
IXSL extensions
Sprint/Milestone:
-
Start date:
2021-06-28
Due date:
% Done:

100%

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

Description

This might not be a bug, just me not understanding the error message.

I have the following code which usually works fine:

<xsl:message>AAAA $content-uri: <xsl:value-of select="$content-uri"/> empty(LDH): <xsl:value-of select="empty(ixsl:get(ixsl:window(), 'LinkedDataHub'))"/> empty(ac:new-object()): <xsl:value-of select="empty(ac:new-object())"/></xsl:message>
<ixsl:set-property name="{$content-uri}" select="ac:new-object()" object="ixsl:get(ixsl:window(), 'LinkedDataHub')"/>
<!-- store this content element -->
<xsl:message>BBBB</xsl:message>
<ixsl:set-property name="content" select="." object="ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub'), $content-uri)"/>
<!-- store the initial SELECT query (without modifiers) -->
<xsl:message>CCCC</xsl:message>

However under some conditions I get this kind of error and I don't get why (includes the debug output):

xsl:message: AAAA $content-uri: https://noi.example.org/queries/default/select-children/#this empty(LDH): false empty(ac:new-object()): false
Warning ixsl:set-property: 'https://noi.example.org/queries/default/select-children/#this' not found for supplied object
xsl:message: BBBB
Warning ixsl:get: object property 'https://noi.example.org/queries/default/select-children/#this' not found
Uncaught J {message: "Required cardinality of value in 'ixsl:set-propert…xpression is exactly one; supplied value is empty", stack: "Error\n    at new J (https://noi.example.org/static…linkeddatahub/js/saxon-js/SaxonJS2.rt.js:819:457)", name: "XError", code: "XPTY0004", xsltLineNr: "583", …}

What am I missing here? What does the warning even mean?

History

#1 Updated by Martynas Jusevicius 3 months ago

I understand the second <ixsl:set-property> fails if the first one did. But why would the first one fail?

#2 Updated by Martynas Jusevicius 3 months ago

Looking at the <ixsl:set-property> documentation, what does this text even mean?

If the specified property does not exist, then there is no error, but a warning is output in the console log.

How does one set the property value for the first time then?

#3 Updated by Martynas Jusevicius 3 months ago

Martin Honnen probably solved this:

My guess is that your argument of the property name, which is https://noi.example.org/queries/default/select-geo-resources/#this "causes" the problem as the potential argument can be a JavaScript "dot" expression e.g. foo.bar.baz and the Saxon library tries to split up that expression by using split("."). In your case the dots are not meant as Javascript "path step" seperators to be split up into e.g. foo bar and baz but are to be taken literally as the name of a single property you want to create. Not sure what is the right way around that, perhaps the ixsl:set-property needs an additional attribute to indicate whether your property name is meant to be used literally or as a dot separated path.

I still need to test this, but this checks out as I had no problems when using localhost instead of noi.example.org.

Any suggested workarounds? URL-encoding the property name does not encode the dots.

#4 Updated by Debbie Lockett 3 months ago

  • Category set to IXSL extensions
  • Status changed from New to In Progress
  • Assignee set to Debbie Lockett

Again, Martin is correct that the problem arises from your use of dot characters in the property names. Effectively Saxon-JS does not allow property names to include dot characters (instead these are used as separators for nested properties), though this is not explicitly stated. The rules for JavaScript property names are complicated because bracket notation actually allows property names to contain characters (e.g. the dot character) that are forbidden in dot notation. We should clarify what Saxon-JS permits in the documentation.

Also, as noted in #note-2, the documentation for ixsl:set-property needs to be tidied up (the sentence about warnings for unknown properties is indeed wrong).

As suggested on xml.com on Slack, the best work around is to replace the use of dots in the property names.

#5 Updated by Debbie Lockett about 2 months ago

  • Status changed from In Progress to Resolved
  • Fix Committed on JS Branch 2 added

I have committed documentation updates to add some warnings that you can't use ixsl:get() and ixsl:set-property to get and set properties with names which contain dot characters. At this stage we are rejecting the suggestion to add a new attribute to indicate whether the property name is meant to be used literally or as a dot separated path. It is fairly straightforward to work around this: either avoid property names with dot characters; or write your own JavaScript global function to set these (https://www.saxonica.com/saxon-js/documentation/index.html#!development/global).

(See also bug #5046 for other documentation improvements for ixsl:set-property; including the issue raised in #note-2.)

#6 Updated by Debbie Lockett about 1 month ago

  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 2.3

Bug fix applied in the Saxon-JS 2.3 maintenance release.

#7 Updated by Debbie Lockett about 1 month ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF Tracking page