Project

Profile

Help

Support #6055 ยป Re_ [SaxonC - Support #6055] (New) PHP SaxonC - How to work with a schematron file_ - 2023-05-31T09_25_06Z.eml

Matt Patterson, 2023-05-31 11:25

 
X-He-Spam-Score: -1.9
Return-Path: <matt@saxonica.com>
Delivered-To: dropbox@plan.io
Received: from m.launch.gmbh ([127.0.0.1])
by m.launch.gmbh with LMTP id GMS6E2USd2TiUgAAJzdhvw
for <dropbox@plan.io>; Wed, 31 May 2023 11:24:53 +0200
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on m.launch.gmbh
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DMARC_NONE,
HTML_MESSAGE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham
autolearn_force=no version=3.4.2
X-Spam-Report:
* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
* [score: 0.0000]
* 0.1 DMARC_NONE DMARC record not found
* -0.1 SPF_PASS SPF check passed
* 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
* 0.0 HTML_MESSAGE BODY: HTML included in message
* -0.0 T_SCC_BODY_TEXT_LINE No description available.
X-Spam-Score: -1.9
Envelope-to: inbox+saxonica+f38e+saxon-c@plan.io
Authentication-Results: m.launch.gmbh; dmarc=none (p=none dis=none) header.from=saxonica.com
Authentication-Results: m.launch.gmbh; spf=pass smtp.mailfrom=matt@saxonica.com
Authentication-Results: m.launch.gmbh; dkim=none; dkim-atps=neutral
Received: from saxonica.positive-dedicated.net (saxonica.positive-dedicated.net [185.27.21.106])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(No client certificate requested)
by m.launch.gmbh (Postfix) with ESMTPS id 14BA28064F
for <inbox+saxonica+f38e+saxon-c@plan.io>; Wed, 31 May 2023 11:24:53 +0200 (CEST)
Received: from [192.168.175.96] (cable-78-34-224-151.nc.de [78.34.224.151])
by saxonica.positive-dedicated.net (Postfix) with ESMTPSA id C5DBB1FFF6
for <inbox+saxonica+f38e+saxon-c@plan.io>; Wed, 31 May 2023 10:24:50 +0100 (BST)
From: Matthew Patterson <matt@saxonica.com>
To: Saxonica Developer Community <inbox+saxonica+f38e+saxon-c@plan.io>
Subject: Re: [SaxonC - Support #6055] (New) PHP SaxonC - How to work with a
schematron file?
Date: Wed, 31 May 2023 11:24:48 +0200
X-Mailer: MailMate (1.14r5964)
Message-ID: <6B399A77-DE06-451E-B165-793F208BB41B@saxonica.com>
In-Reply-To: <redmine.issue-6055.20230531080730.4063@plan.io>
References: <redmine.issue-6055.20230531080730.4063@plan.io>
<redmine.issue-6055.20230531080730.4063@plan.io>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="=_MailMate_90C96CF2-B5BE-48E6-B0D0-9D130705FFC4_="
Embedded-HTML: [{"plain":[1059,2056],"uuid":"2B3B2748-EF79-4CB4-8903-2D0E3C2EFEA2"}]


--=_MailMate_90C96CF2-B5BE-48E6-B0D0-9D130705FFC4_=
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

The open-source Schematron implementation SchXSLT =

(https://github.com/schxslt/schxslt) can be used to generate XSLT files =

from your Schematron files for doing validation using Saxon.

Using the XSLT-only distribution of SchXSLT, you can use the =

`2.0/pipeline.xsl` XSLT with Saxon to compile your `.sch` file to an =

XSLT that you can then use Saxon to run against your XML files. If you =

haven=E2=80=99t already seen them, there are a couple of very simple samp=
le =

PHP scripts at =

https://www.saxonica.com/saxon-c/documentation12/index.html#!samples/samp=
les_php =

that show how to load an XSLT file and transform an XML file with it.

You should only need to compile the `.sch` file to an XSLT once, so you =

could do that using the command line (see =

https://www.saxonica.com/saxon-c/documentation12/index.html#!starting/run=
ning) =

to create the final XSLT file you=E2=80=99ll use to validate your documen=
ts.

This is a very quick overview, but that should hopefully be enough to =

get you started.

All the best,

Matt

On 31 May 2023, at 10:07, Saxonica Developer Community wrote:

> --- In your reply, please do not write below this line ---
>
> Issue #6055 has been reported by Steve Goffinet.
>
> ----------------------------------------
> Support #6055: PHP SaxonC - How to work with a schematron file?
> https://saxonica.plan.io/issues/6055?pn=3D1
>
> * Author: Steve Goffinet
> * Status: New
> * Priority: Normal
> * Assignee: Steve Goffinet
> * Category: PHP API
> * Start date: 2023-05-31
> ----------------------------------------
> Hello,
>
> I have a problem implementing the SaxonC PHP extension. I managed to =

> install the extension and it is loaded. As the validatorExamples.php =

> is working I assume the class works as expected.
>
>
> I am new to xslt and schematron and after doing some research I =

> believe to understand that SaxonC cannot work with schematron files =

> and it needs to be converted to an xsd or xsl file. Could
> you please advise me how to proceed with my schematron file? To what =

> format shall I convert my schematron file and how do I do that to make =

> it work? Or maybe there is a different approach?
>
> Here is the definition of my file:
>
> <schema xmlns=3D"http://purl.oclc.org/dsdl/schematron" xmlns:u=3D"utils=
" =

> schemaVersion=3D"iso" queryBinding=3D"xslt2">
>
>
> I would be very happy about an guiding hand.
>
>
> Thank you and best regards
> Steve
>
> Environement:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> PHP: 7.3
> Debian 4.19.208-1 (2021-09-29) x86_64
> Saxon 11.5
>
>
>
>
> Results from : validatorExamples.php
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> PHP Schema Validation in SaxonC examples
> Saxon Processor version: SaxonC-PE 11.5 from Saxonica
> exampleSimple1:
> Doc is valid
>
> exampleSimple2:
> Doc family.xml is valid!
>
>
> exampleSimple3:
> Error: Doc is not valid!
>
>
>
> --
> You have received this notification because you have either subscribed =

> to or are involved in a project on Saxonica Developer Community site.
> To change your notification preferences, please click here: =

> https://saxonica.plan.io/my/account?tour=3Dmail_preferences
>
> This notification was cheerfully delivered by https://plan.io
> =C2=A0


-- =

Matt Patterson
Saxonica

--=_MailMate_90C96CF2-B5BE-48E6-B0D0-9D130705FFC4_=
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html>
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/xhtml; charset=3Dutf-8"=
>
</head>
<body><div style=3D"font-family: sans-serif;"><div class=3D"markdown" sty=
le=3D"white-space: normal;">
<p dir=3D"auto">The open-source Schematron implementation SchXSLT (<a hre=
f=3D"https://github.com/schxslt/schxslt" style=3D"color: #3983C4;">https:=
//github.com/schxslt/schxslt</a>) can be used to generate XSLT files from=
your Schematron files for doing validation using Saxon.</p>
<p dir=3D"auto">Using the XSLT-only distribution of SchXSLT, you can use =
the <code style=3D"margin: 0 0; padding: 0 0.25em; border-radius: 3px; ba=
ckground-color: #F7F7F7;">2.0/pipeline.xsl</code> XSLT with Saxon to comp=
ile your <code style=3D"margin: 0 0; padding: 0 0.25em; border-radius: 3p=
x; background-color: #F7F7F7;">.sch</code> file to an XSLT that you can t=
hen use Saxon to run against your XML files. If you haven=E2=80=99t alrea=
dy seen them, there are a couple of very simple sample PHP scripts at <a =
href=3D"https://www.saxonica.com/saxon-c/documentation12/index.html#!samp=
les/samples_php" style=3D"color: #3983C4;">https://www.saxonica.com/saxon=
-c/documentation12/index.html#!samples/samples_php</a> that show how to l=
oad an XSLT file and transform an XML file with it.</p>
<p dir=3D"auto">You should only need to compile the <code style=3D"margin=
: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;"=
>.sch</code> file to an XSLT once, so you could do that using the command=
line (see <a href=3D"https://www.saxonica.com/saxon-c/documentation12/in=
dex.html#!starting/running" style=3D"color: #3983C4;">https://www.saxonic=
a.com/saxon-c/documentation12/index.html#!starting/running</a>) to create=
the final XSLT file you=E2=80=99ll use to validate your documents.</p>
<p dir=3D"auto">This is a very quick overview, but that should hopefully =
be enough to get you started.</p>
<p dir=3D"auto">All the best,</p>
<p dir=3D"auto">Matt</p>
<p dir=3D"auto">On 31 May 2023, at 10:07, Saxonica Developer Community wr=
ote:</p>
</div><blockquote class=3D"embedded" style=3D"margin: 0 0 5px; padding-le=
ft: 5px; border-left: 2px solid #777777; color: #777777;"><div id=3D"2B3B=
2748-EF79-4CB4-8903-2D0E3C2EFEA2">
<div style=3D"font-family:&quot;ProximaNova-Regular&quot;, Helvetica, Ari=
al, sans-serif;font-size:14px;line-height:1.4em;color:#333434">
<table class=3D"planio_mail" width=3D"100%" cellspacing=3D"0" cellpadding=
=3D"0" style=3D"border-collapse:collapse;margin-bottom:1em;border:1px sol=
id #bbb;padding:4px;border-spacing:0;margin-bottom:0;width:100%;border:no=
ne;padding:0">
<tr>
<td class=3D"planio_mail header" style=3D"border:1px solid #bbb;padding:4=
px;text-align:center;width:100%;font-family:MarketWeb, Helvetica, Arial, =
sans-serif;font-size:0.8em;color:#D7D7D7;border:none;padding:0">
<p>--- In your reply, please do not write below this line ---</p>
</td>
</tr>
<tr>
<td class=3D"planio_mail" style=3D"border:1px solid #bbb;padding:4px;bord=
er:none;padding:0">Issue <a href=3D"https://saxonica.plan.io/issues/6055?=
pn=3D1" style=3D"color:#0088b7">#6055</a> has been reported by Steve Goff=
inet.
<hr style=3D"width:100%;height:1px;background:#ccc;border:0;margin:1.2em =
0">
<h1 style=3D"font-family:&quot;ProximaNova-Bold&quot;, Helvetica, Arial, =
sans-serif;font-weight:normal;margin:0px;font-size:1.3em;line-height:1.4e=
m"><a href=3D"https://saxonica.plan.io/issues/6055?pn=3D1" style=3D"color=
:#0088b7;text-decoration:none">Support #6055: PHP SaxonC - How to work wi=
th a schematron file?</a> <span class=3D"badge badge-status-open" style=3D=
"position:relative;font-weight:bold;font-size:10px;bottom:2px;padding:1px=
3px;margin-right:2px;margin-left:2px;border-radius:2px;text-transform:up=
percase;text-decoration:none;color:#205D86;border:1px solid #205D86">open=
</span></h1>
<ul class=3D"details" style=3D"color:#959595;margin-bottom:1.5em">
<li><strong>Author:</strong> Steve Goffinet</li>
<li><strong>Status:</strong> New</li>
<li><strong>Priority:</strong> Normal</li>
<li><strong>Assignee:</strong> Steve Goffinet</li>
<li><strong>Category:</strong> PHP API</li>
<li><strong>Start date:</strong> 2023-05-31</li>
</ul>
<p>Hello,</p>
<p>I have a problem implementing the SaxonC PHP extension. I managed to i=
nstall the extension and it is loaded. As the validatorExamples.php is wo=
rking I assume the class works as expected.</p>
<p>I am new to xslt and schematron and after doing some research I believ=
e to understand that SaxonC cannot work with schematron files and it need=
s to be converted to an xsd or xsl file. Could you please advise me how t=
o proceed with my schematron file? To what format shall I convert my sche=
matron file and how do I do that to make it work? Or maybe there is a dif=
ferent approach?</p>
<p>Here is the definition of my file:</p>
<p>I would be very happy about an guiding hand.</p>
<p>Thank you and best regards Steve</p>
<a name=3D"Environement" style=3D"color:#0088b7" id=3D"Environement"></a>=

<h1 style=3D"font-family:&quot;ProximaNova-Bold&quot;, Helvetica, Arial, =
sans-serif;font-weight:normal;margin:0px;font-size:1.3em;line-height:1.4e=
m">Environement:<a href=3D"#Environement" class=3D"wiki-anchor" style=3D"=
color:#0088b7;text-decoration:none;display:none">=C2=B6</a></h1>
<p>PHP: 7.3 Debian 4.19.208-1 (2021-09-29) x86_64 Saxon 11.5</p>
<a name=3D"Results-from-validatorExamplesphp" style=3D"color:#0088b7" id=3D=
"Results-from-validatorExamplesphp"></a>
<h1 style=3D"font-family:&quot;ProximaNova-Bold&quot;, Helvetica, Arial, =
sans-serif;font-weight:normal;margin:0px;font-size:1.3em;line-height:1.4e=
m">Results from : validatorExamples.php<a href=3D"#Results-from-validator=
Examplesphp" class=3D"wiki-anchor" style=3D"color:#0088b7;text-decoration=
:none;display:none">=C2=B6</a></h1>
<p>PHP Schema Validation in SaxonC examples Saxon Processor version: Saxo=
nC-PE 11.5 from Saxonica exampleSimple1: Doc is valid</p>
<p>exampleSimple2: Doc family.xml is valid!</p>
<p>exampleSimple3: Error: Doc is not valid!</p>
<div itemscope=3D"itemscope" itemtype=3D"http://schema.org/EmailMessage">=

<div itemscope=3D"itemscope" itemprop=3D"action" itemtype=3D"http://schem=
a.org/ViewAction">
<link itemprop=3D"url" href=3D"https://saxonica.plan.io/issues/6055?pn=3D=
1">
<meta itemprop=3D"name" content=3D"View Issue"></div>
<meta itemprop=3D"description" content=3D"View this issue update on Plani=
o"></div>
</td>
</tr>
<tr>
<td class=3D"planio_mail footer" style=3D"border:1px solid #bbb;padding:4=
px;font-size:0.8em;width:100%;border:none;padding:0">
<hr style=3D"width:100%;height:1px;background:#ccc;border:0;margin:1.2em =
0">
<p>You have received this notification because you have either subscribed=
to or are involved in a project on Saxonica Developer Community site. To=
change your notification preferences, please click here: <a href=3D"http=
s://saxonica.plan.io/my/account?tour=3Dmail_preferences" class=3D"externa=
l" style=3D"color:#0088b7">https://saxonica.plan.io/my/account?tour=3Dmai=
l_preferences</a></p>
</td>
</tr>
<tr>
<td class=3D"planio_mail planio_footer" style=3D"border:1px solid #bbb;pa=
dding:4px;text-align:center;width:100%;font-family:MarketWeb, Helvetica, =
Arial, sans-serif;font-size:1.2em;color:#D7D7D7;border:none;padding:0"><b=
r>
<div><a href=3D"https://plan.io/" style=3D"color:#0088b7;color:#D7D7D7;te=
xt-decoration:none">This notification was cheerfully delivered by</a></di=
v>
</td>
</tr>
<tr>
<td class=3D"planio_mail planio_footer_logo" style=3D"border:1px solid #b=
bb;padding:4px;text-align:center;width:100%;border:none;padding:0"><a hre=
f=3D"https://plan.io/" title=3D"Planio" style=3D"color:#0088b7"><img src=3D=
"https://assets.plan.io/images/planio_logo_gray_204x50.png" height=3D"25"=
width=3D"102" border=3D"0" alt=3D"Planio" style=3D"vertical-align:middle=
;border:none"></a></td>
</tr>
</table>
</div></div></blockquote>
<div class=3D"markdown" style=3D"white-space: normal;">
<p dir=3D"auto">--<br>
Matt Patterson<br>
Saxonica</p>

</div>
</div>
</body>

</html>

--=_MailMate_90C96CF2-B5BE-48E6-B0D0-9D130705FFC4_=--
    (1-1/1)