Skip to content

Scope of namespace declarations and XPath expressions defective #116

@jperterm

Description

@jperterm

I discovered two issues with namespace declaration scopes and XPath expressions.

First thing is a missing error, that a namespace is undeclared:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                exclude-result-prefixes="#all"
                version="3.0">
    <xsl:output method="xml" indent="yes"/>
    <xsl:mode on-no-match="shallow-copy"/>
    <xsl:template match="/*" mode="#all">
        <out>
            <xsl:value-of xmlns:ns1="urn:namespace1" select="@ns1:attr"/>
            <xsl:value-of select="@ns1:attr"/><!-- Missing error caused by line above -->
        </out>
    </xsl:template>
</xsl:stylesheet>

The second thing is an error that must not occur:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                exclude-result-prefixes="#all"
                version="3.0">
    <xsl:output method="xml" indent="yes"/>
    <xsl:mode on-no-match="shallow-copy"/>
    <xsl:template match="/*" mode="#all">
        <out>
            <!-- False error caused by namespace declaration **following up** the select attribute -->
            <xsl:value-of select="@ns1:attr" xmlns:ns1="urn:namespace1"/>
        </out>
    </xsl:template>
</xsl:stylesheet>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions