Skip to content

Is validation of XSLT 3.0 stylesheets supported? #1

Description

@martin-honnen

I have tried to use the sample app to validate an XSLT 3.0 stylesheet against the W3C XSD 1.1 schema for XSLT 3, the app crashes (it seems when/after schemas = sf.newSchema(schemaSources);).

Is XSD 1.1 based validation supported by the used Xerces version? Or what else could be the reason for the crash?

Command line arguments and stack trace:

PS C:\Users\marti\source\repos\XmlResolverValidationTest1\XmlResolverValidationTest1> java -jar C:\Users\marti\OneDrive\Documents\xmlresolver-sampleapp-3.0.1\sampleapp-3.0.1.jar parse -xsd https://www.w3.org/TR/xslt-30/schema-for-xslt30.xsd .\xslt3-sample2.xsl
Performing a non-validating parse of .\xslt3-sample2.xsl
Continuing with XML Schema validation with:
        https://www.w3.org/TR/xslt-30/schema-for-xslt30.xsd
Using the XML Resolver with the following catalogs:
        jar:file:/C:/Users/marti/OneDrive/Documents/xmlresolver-sampleapp-3.0.1/lib/xmlresolver-3.0.1-data.jar!/org/xmlresolver/catalog.xml
OASIS XML Catalogs processing instruction catalogs will be used
The resolver will not cache resources

? Resolved: xsl:stylesheet (file:///C:/Users/marti/source/repos/XmlResolverValidationTest1/XmlResolverValidationTest1/xslt3-sample2.xsl)
Parse complete
Exception in thread "main" java.lang.NullPointerException
        at java.net.URI$Parser.parse(URI.java:3041)
        at java.net.URI.<init>(URI.java:588)
        at org.xmlresolver.CatalogResolver.resolveNamespace(CatalogResolver.java:242)
        at org.xmlresolver.Resolver.resolveResource(Resolver.java:121)
        at org.xmlresolver.example.ChattyResolver.resolveResource(ChattyResolver.java:148)
        at org.apache.xerces.util.DOMEntityResolverWrapper.resolveEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.resolveEntity(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.resolveDocument(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.resolveSchema(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.constructTrees(Unknown Source)
        at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
        at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
        at org.xmlresolver.example.SampleApp.parse(SampleApp.java:264)
        at org.xmlresolver.example.SampleApp.process(SampleApp.java:108)
        at org.xmlresolver.example.SampleApp.main(SampleApp.java:74)

The XSLT 3.0 sample is

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="3.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="#all"
  expand-text="yes">

  <xsl:output method="html" indent="yes" html-version="5"/>

  <xsl:mode on-no-match="shallow-copy"/>

  <xsl:template match="/" name="xsl:initial-template">
    <xsl:next-match/>
    <xsl:comment xmlns:saxon="http://saxon.sf.net/">Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
  </xsl:template>

</xsl:stylesheet>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions