Project

Profile

Help

Bug #5805

closed

Set locator to XmlProcessingIncident

Added by Radu Coravu over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2023-01-11
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
11, 12, trunk
Fix Committed on Branch:
11, 12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

Let' say in my XSLT I made a silly mistake and used xsl:attributes instead of xsl:attribute.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:p="http://www.oxygenxml.com/ns/samples/personal"
    exclude-result-prefixes="p">
    <xsl:template match="/">
            <xsl:element name="table">
                <xsl:attributes name="border">1</xsl:attributes>
            </xsl:element>
    </xsl:template>
</xsl:stylesheet>

I create a transformer which fails with the error "Unknown XSLT instruction xsl:attributes" but there is no location for it, its line is -1.

I suggest here: net.sf.saxon.style.StyleElement.setValidationError(XmlProcessingIncident, OnFailure) to add some extra code:

        if(reason != null && reason.getLocation() == Loc.NONE) {
            reason.setLocation(allocateLocation());
        }

Please register to edit this issue

Also available in: Atom PDF