Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

How to Compare a PHP Schematron Port with the Original

A differential test suite can show whether a PHP Schematron port matches the original for the rules, features, and runtime cases you actually support.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run the original Schematron validator and the PHP port against the same XML fixtures, then compare their structured results rule by rule. A matching test suite gives you evidence for the schema edition, features, and cases you tested; it does not prove universal Schematron conformance.

First define what “correct” means

Schematron expresses rules and assertions about XML, commonly using XPath. In the legacy XSLT skeleton workflow, the schema is compiled into XSLT, which then validates an XML document and can produce an SVRL report. That report can contain more information than a simple valid/invalid result. See the Schematron project and its SVRL documentation.

As an Amazon Associate I earn from qualifying purchases.

Before writing tests, record the contract the PHP implementation is expected to meet:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The exact .sch revision, declared Schematron edition, and query binding.
  • The active phase, included resources, namespace declarations, and any extension functions.
  • The PHP version and XML/XPath API used in deployment.
  • Which results matter to callers: validity, severity, messages, diagnostics, locations, fired-rule information, and successful reports.

This prevents a port from appearing equivalent merely because both implementations return the same pass/fail bit while disagreeing on details an application consumes.

Build paired fixtures for the rules

For each assertion or rule, create at least one XML document that should pass and one minimal document that should fail. For conditional or relational rules, vary one relevant condition at a time. Keep the fixture, expected outcome, and rule identifier together so a mismatch points to a specific behavior.

A simple example is a rule requiring a particular element: test a document where it is present and populated, then one where it is absent. If the rule also rejects blank content, add separate empty and whitespace-only cases rather than assuming they behave alike.

Expand the fixture set to cover the features the schema actually uses:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Required and forbidden elements or attributes; empty, whitespace-only, and populated text.
  • Value patterns, code-list membership, and relationships between fields.
  • Namespaced elements and attributes, including prefixes declared for XPath.
  • Context selection, nested nodes, axes, and predicates used by the rules.
  • Every supported phase and include path; abstract patterns or rules, diagnostics, severity, and extensions where applicable.
  • Malformed XML and parser errors, tracked separately from Schematron assertion failures.

Namespace behavior deserves explicit cases: Schematron guidance uses sch:ns to declare prefixes used in XPath, and PHP’s XPath APIs provide namespace registration. A validator that parses the same document but binds a prefix differently can silently select different nodes. See PHP’s DOMXPath namespace registration documentation.

Run both validators and compare structured results

  1. Choose a reference engine whose supported edition, query binding, and feature set are known.
  2. Run the same schema and XML fixture through that engine and the PHP implementation.
  3. Normalize only presentation details that are not part of your contract, then compare the structured outcomes.
  4. For each difference, identify the rule or assertion, inspect the two reports, and decide whether the PHP port is wrong or the contract intentionally allows the variation.

Compare failed assertions and, where relevant, fired rules, successful reports, messages, diagnostics, severity, and locations in SVRL or an equivalent structure. Do not normalize away differences that downstream consumers rely on. If report ordering is not contractual, compare equivalent sets rather than serialized bytes; if ordering matters, assert it explicitly.

The NEMSIS Technical Assistance Center describes a domain-specific test-kit workflow that generates XML cases for passing or failing particular Schematron rules and checks expected results. It is a useful example of the method, not evidence that any particular PHP port has passed: NEMSIS Schematron Development Kit.

Account for PHP and Schematron version differences

XPath and XML APIs

PHP’s DOMXPath evaluates XPath 1.0 and supports namespace registration. PHP 8.4 introduced DomXPath, documented as a modern, spec-compliant equivalent. Check the production runtime and enabled XML extensions rather than assuming a development machine matches it: DOMXPath and DomXPath.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

XMLReader is a forward-only pull parser. If the port uses it for streaming, test whether the implementation can reproduce the context and navigation behavior of the tree-based XPath rules; the cursor model may require extra machinery. PHP documents the API at XMLReader.

Also test scalar XPath results on the actual PHP version if using SimpleXMLElement::xpath(): PHP 8.5 changes behavior for expressions that return values such as booleans or numbers. See the SimpleXML XPath documentation.

Edition, binding, and feature scope

The Schematron project reports the fourth edition as ISO Schematron 2025, with additions including XQuery 3.1 and XSLT 3.1 bindings, plus group, library, rules, typed let, and severity features. A port designed for an older subset should state that boundary explicitly; a .sch extension alone does not identify supported features. See the Schematron edition information.

The legacy skeleton is a possible reference for schemas within its supported scope, but its project records conformance limitations and recommends considering SchXslt for new applications. An independently implemented validator can also be useful as a comparison path, but confirm its edition and feature support before treating it as authoritative. Sources include the legacy skeleton project and the ph-schematron project.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Turn every mismatch into a regression test

When a difference appears, reduce it to the smallest XML fixture that still reproduces the mismatch. Preserve the rule identifier, reference output, PHP output, runtime version, and the reason the difference was fixed or accepted. Add the case permanently and rerun the suite after translation changes and on each supported PHP/runtime combination.

Keep parser failures distinct from failed assertions: malformed input is not evidence that a Schematron rule fired. Likewise, if a discrepancy is accepted because the output ordering is outside the contract, document that once in the test comparison policy instead of quietly discarding other report differences.

State the result at the scope you verified

A defensible claim names the reference engine, schema revision, supported feature subset, and tested cases—for example: “The PHP implementation matches engine X for schema revision Y and the declared subset across the tested namespace, phase, and diagnostics cases.” Do not claim complete ISO conformance unless an appropriate conformance assessment supports it. A test suite establishes observed behavior over its cases, not mathematical proof of equivalence.

Release checklist

  • Schema revision, edition, binding, phase, includes, and extensions are recorded.
  • Each rule has passing and failing fixtures; relevant namespace and XPath edge cases are covered.
  • Both implementations receive identical XML inputs.
  • Structured outputs are compared at the level consumers depend on.
  • Reference-engine limitations and PHP runtime versions are part of the documented scope.
  • Every resolved mismatch is now a permanent regression case.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.