Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSLT/SCH files #37

Closed
AurelienPillevesse opened this issue Oct 18, 2023 · 3 comments
Closed

XSLT/SCH files #37

AurelienPillevesse opened this issue Oct 18, 2023 · 3 comments

Comments

@AurelienPillevesse
Copy link

AurelienPillevesse commented Oct 18, 2023

Currently, I'm looking to use this library if my use-case is covered by this one.

I explain :
To validate an e-invoicing (electronic invoice), I have to execute a Schematron on the XML file.

I have this .xslt file : https://github.com/ConnectingEurope/eInvoicing-EN16931/blob/master/cii/xslt/EN16931-CII-validation.xslt
I have this .sch file : https://github.com/ConnectingEurope/eInvoicing-EN16931/blob/master/cii/schematron/EN16931-CII-validation.sch

If someone can help me but it's the first time I'm working with Schematron. I would like to get all errors from my XML after validation with the XSLT/SCH file.

The only feedback I have for the moment :
Genkgo\Xsl\Exception\TransformationException: Transformation failed: XSLTProcessor::importStylesheet(): Invalid expression

And my code :

$xml is a \DOMDocument

$xsl = new \DOMDocument();
$xsl->loadXML((string) file_get_contents(self::SPECIFICATION_TO_SCHEMATRON[$specificationIdentifier]));
$transpiler = new XsltProcessor(new NullCache());
$transpiler->registerPHPFunctions();
$transpiler->importStylesheet($xsl);
$transpiler->transformToXML($xml);
@frederikbosch
Copy link
Contributor

I have no idea to be honest. I have never worked with Schematron. The error feedback you get from this package is not very good. So I cannot help you right now. If you succeed I am interested to know.

@LeonardusSagittarius
Copy link

I am also trying to implement a Schematron validation, but don't get it to work.

xslt file: https://github.com/schxslt/schxslt/blob/master/core/src/main/resources/xslt/2.0/pipeline-for-svrl.xsl
sch file: https://github.com/w3c/epubcheck/blob/main/src/main/resources/com/adobe/epubcheck/schema/30/package-30.sch

I am getting this Exception:
Transformation failed: Transformation failed: XSLTProcessor::importStylesheet(): compilation error: file gxsl://localhost/[...]/svrl.xsl line 11 element sequence

The problem is obviously caused by the included file: https://github.com/schxslt/schxslt/blob/master/core/src/main/resources/xslt/2.0/svrl.xsl

My code looks like this:

`$pipeline_for_svrl = new \DOMDocument();
$pipeline_for_svrl->load( Schematron::XSLT_PATH . '2.0/pipeline-for-svrl.xsl' );

$schema = new \DOMDocument();
$schema->load( $schema_path );

$xslt = new XsltProcessor( new NullCache() );
$xslt->importStylesheet( $pipeline_for_svrl );

$transformed = $xslt->transformToXML( $schema );`

@frederikbosch
Copy link
Contributor

That's a duplicate of issue #33. We do not have support for xsl:sequence yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants