Project

Profile

Help

Bug #5364

closed

Can't get keys to work over SVG elements

Added by Martynas Jusevicius 7 months ago. Updated 3 days ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
XSLT Conformance
Sprint/Milestone:
Start date:
2022-03-01
Due date:
% Done:

0%

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

Description

Hi. In my original stylesheet I have defined such keys:

    <xsl:key name="lines-by-start" match="svg:line" use="@ac:id1"/>
    <xsl:key name="lines-by-end" match="svg:line" use="@ac:id2"/>

However I get an error when I try to use them:

​code: "XTDE0640"
​message: "Definition of key Q{}lines-by-start is circular"
​name: "XError"

I've attempted to create a test case with the same keys: https://namedgraph.github.io/saxon-js2-test/ Stylesheet: https://namedgraph.github.io/saxon-js2-test/client.xsl (see the CIRCULAR KEY template) Note that there's an <svg> element in the HTML.

However in the test stylesheet I get a different error:

code: "FORG0001"
​message: "Invalid local name: 'ac:id1' (prefix='', uri='null')"
​name: "XError"

Maybe I've messed up the namespaces in SVG, but I don't see where.

Actions #1

Updated by Martynas Jusevicius 7 months ago

I get Invalid local name: 'ac:id1' (prefix='', uri='null') even if I don't use the keys.

So I wonder if the root of the problem are the ac:id1/ac:id2 attributes in SVG? Are custom namespaces not supported?

Actions #2

Updated by Martynas Jusevicius 7 months ago

The Invalid local name error is the same as in #5019.

Actions #3

Updated by Norm Tovey-Walsh 7 months ago

What browser are you using, and on what platform? I fear the underlying cause here may be that the browser doesn't build a DOM that has namespaces declared properly. HTML5 munges all the SVG and MathML elements so they don't have (or at least don't need to have) namespaces. It's possible that the antipathy towards namespaces exhibited by the browsers extends to ignoring attempts to use them in HTML5 documents. You might have better luck if you arrange for the server to assert that these are XHTML documents, but I don't know what other consequences that might have.

Actions #4

Updated by Michael Kay 7 months ago

I suspect the XTDE0640 means that we've gone into index construction when there's already a half-constructed index from a previous call, and the reason for that is a failure during the previous construction attempt. So the underlying error is being masked.

Actions #5

Updated by Martynas Jusevicius 7 months ago

Observed on Firefox 97.0.1 (64-bit) on Windows 10.

So far I've addressed this by replacing attributes in a custom namespace with data- attributes. The keys then work as expected.

Actions #6

Updated by Norm Tovey-Walsh 5 months ago

I think the invalid local name error happens if you serve the page up as HTML. If I serve the page up as XHTML, that error goes away. But I can't reproduce the circular key error either.

Actions #7

Updated by Norm Tovey-Walsh 5 months ago

  • Status changed from New to AwaitingInfo

If you switch to XHTML, can you reproduce the bug in your test case?

Actions #9

Updated by Norm Tovey-Walsh 30 days ago

  • Sprint/Milestone set to SaxonJS 2.5

If we don't get any more information, I'm afraid we'll have to close this as "cannot reproduce".

Actions #10

Updated by Martynas Jusevicius 30 days ago

That's fine :)

Actions #11

Updated by Norm Tovey-Walsh 3 days ago

  • Status changed from AwaitingInfo to Closed

Could not reproduce. If you can provide a test case, please reopen the bug or open a new one.

Please register to edit this issue

Also available in: Atom PDF Tracking page