# XML & Schematron Engineering

Schema design, transformation pipelines, and validation frameworks that enforce quality at the structural level — before content ever reaches a reviewer.

in :: engineering.layersschematransformvalidate<chapter>well-formedextense.engineering<chapter>governedFIG. 01/engineering.layersRAW → GOVERNED

## Beyond Well-Formedness

XML is just text until you enforce the rules. We design and implement the schema layers, transformation pipelines, and business-rule validation that turn raw markup into governed, publishable content.

- ### XSLT 3.0 Development

Complex multi-source transformations — merging XML streams, generating JSON, SQL, or EPUB output, and handling million-node datasets with XSLT 3.0 streaming. We write production-grade stylesheets with full unit test coverage using Saxon.

- ### Schematron Business Rules

DTD and XSD check structure. Schematron checks business logic: “If classification is ‘Internal’, then distribution must be ‘Restricted’.” We author ISO Schematron rule sets that catch semantic violations before they reach production.

- ### Schema Design & Specialization

Custom XSD, RelaxNG, and DITA specializations that model your product data without breaking standards compliance. We extend element models, add domain-specific attributes, and maintain backward compatibility with existing toolchains.

## The Validation Stack

Production-grade content governance requires multiple validation layers — each catching a different class of defect.

1. ### Structure
   
   DTD / XSD / RelaxNG
   
   Parent-child rules — every element has its place in the tree.

2. →
3. ### Business Logic
   
   Schematron
   
   Semantic constraints that DTD and XSD can’t express.

4. →
5. ### Style & Naming
   
   Checkstyles
   
   Conventions and terminology kept consistent across writers.

6. →
7. ### Link Integrity
   
   Cross-reference & conref
   
   Every reference resolves; no dangling links survive.

8. →
9. ### Clean Output
   
   Build-ready XML
   
   Validated content, ready for the publishing pipeline.

- ### XQuery & XPath

Full-text queries, content audits, and cross-collection analytics in BaseX, MarkLogic, or eXist-db. We build reporting dashboards that surface reuse metrics, orphaned topics, and metadata gaps.

- ### CI-Integrated Validation

We embed validation into Jenkins, GitHub Actions, and Azure DevOps pipelines. Every commit triggers schema validation, Schematron checks, and broken-link detection — blocking bad content before it merges.

- ### Migration Schema Mapping

Mapping legacy schemas (DocBook, custom DTDs, FrameMaker EDD) to DITA or S1000D. We document every mapping decision and produce automated XSLT converters for repeatable batch migration.

## Modern XML Processing

XSLT is powerful, but it’s not always the right tool. We build with the full spectrum of modern technologies for XML transformation and delivery.

- ### Programmatic Transforms (Java & C#)

Saxon API, JAXB, StAX, and LINQ to XML for transformations that require database lookups, API calls, or complex business logic mid-transform. Testable, debuggable, and CI/CD-native — unlike monolithic XSLT stylesheets.

- ### Python & Node.js Pipelines

lxml, Beautiful Soup, and fast-xml-parser for rapid automation — content migration scripts, metadata enrichment, batch validation, and glue code between XML systems and modern APIs. Ideal when speed of development matters more than raw throughput.

- ### JSON & YAML Interoperability

Modern systems speak JSON, not XML. We build bidirectional bridges that preserve semantic structure across formats — XML ↔ JSON for REST APIs, XML ↔ YAML for configuration pipelines, and XML → GraphQL schemas for flexible content queries.

- ### GraphQL Content Layers

Expose XML repositories through GraphQL endpoints where consumers request exactly the elements, attributes, and metadata they need. We build the schema, resolvers, and caching layer — turning your XML store into a queryable content API.

- ### CSS Paged Media → PDF

Replace XSL-FO with CSS Paged Media for print-quality PDF generation from XML. Using Prince XML, Antenna House, or WeasyPrint — your web team’s CSS skills now produce regulated-grade PDFs. One styling language for web and print.

- ### XML Databases & Search

Native XML storage in MarkLogic, BaseX, or eXist-db combined with Elasticsearch or Algolia for full-text search. We architect the storage and retrieval layer for content repositories that need fine-grained access, versioning, and faceted navigation.

## AI-Ready Content Engineering

Structured XML is the ideal input for AI systems. We engineer the additional layers that make your content retrievable, embeddable, and citable by machines.

- ### RAG Chunking & Embedding Prep

We transform XML content into right-sized chunks for vector embedding — respecting topic boundaries, semantic context, and token limits. Each chunk carries its metadata lineage so the retrieval system knows what it’s returning and why.

- ### Semantic Labeling for LLMs

Every XML element can carry machine-readable context — content type, product version, audience, domain. When an LLM retrieves a chunk, it understands whether it’s citing a procedure, a concept, a warning, or a specification. We engineer those labels into your schema.

- ### JSON-LD & Schema.org Mapping

Transform XML metadata into Schema.org structured data and JSON-LD — for rich search results, knowledge panel eligibility, and semantic web interoperability. Your content becomes discoverable by Google, AI assistants, and enterprise search platforms.

- ### Knowledge Graph Generation

Map XML taxonomies, cross-references, and relationship tables to RDF triples and OWL ontologies. Your documentation becomes a queryable knowledge graph — answering complex cross-system questions that flat search cannot.

- ### Embedding-Friendly Transforms

Custom XSLT/Python pipelines that output clean plain text or Markdown from XML — stripped of markup noise but preserving structural context as metadata. Optimized for OpenAI, Cohere, or open-source embedding models.

- ### Content API for AI Pipelines

REST and GraphQL endpoints that serve XML-sourced content to LangChain, LlamaIndex, or custom RAG frameworks. We build the retrieval layer — with filtering by metadata, version, audience, and content type — so your AI gets the right content, not just any content.

### Why Structured XML Is an AI Advantage

Organizations trying to feed unstructured Word and PDF content to AI systems spend most of their effort on parsing, chunking, and metadata extraction. If your content is already in structured XML, you’ve solved the hardest part. We build the transform layer that bridges XML governance with AI consumption — so your existing content investment compounds into AI readiness.
