<?xml version="1.0" encoding="UTF-8"?>
<xao-docs>
  <site name="XaoDocs" product="Xao" version="1.0.0-dev" homepage="https://xao.ndx.au" repo="https://github.com/ndx-au/Xao" examples-repo="https://github.com/ndx-au/xao-example-apps"/>
  <request slug="reference-apps" theme="atlas" path="/xml/reference-apps" xml-url="/xml/reference-apps"/>
  <themes>
    <theme id="atlas" name="Atlas" tagline="Three-column reference desk with persistent sidebar and sticky page outline" audience="API and framework developers browsing across sections" structure="3-column grid: left navigation sidebar, center article, right on-this-page outline" css="/assets/atlas.css" active="true"/>
    <theme id="folio" name="Folio" tagline="Editorial journal spread with XPath-grouped numbered chapters and collapsible library" audience="Architects and evaluators reading long-form conceptual chapters" structure="Editorial cover header, collapsible library drawer, and sibling-grouped numbered chapter sections" css="/assets/folio.css" active="false"/>
    <theme id="console" name="Console" tagline="Operations dashboard with telemetry strip and collapsible H2 module accordions" audience="SREs, operators, and runtime engineers scanning sections quickly" structure="Command header, telemetry bar, compact nav rail, and expandable &lt;details&gt; module accordions" css="/assets/console.css" active="false"/>
    <theme id="reader" name="Reader (A11y)" tagline="WCAG AAA single-column linear reader with upfront summary, numbered TOC, and zero JS" audience="Screen reader users, keyboard-only navigation, and low-vision / cognitive accessibility" structure="Multi-landmark skip links, upfront document summary, inline numbered TOC, figure-wrapped code blocks, directory after article, zero JS" css="/assets/reader.css" active="false"/>
    <theme id="handbook" name="Handbook" tagline="Single-column print-ready technical specification sheet with metadata ledger" audience="Technical reviewers, auditors, and print/PDF export workflows" structure="Single-column specification document with &lt;dl&gt; metadata ledger, numbered outline, and print stylesheet" css="/assets/handbook.css" active="false"/>
  </themes>
  <navigation>
    <section name="Start Here">
      <item slug="index" title="Xao Documentation" description="XML Application Objects for PHP 8 and PHC — zero-dependency XML content aggregation and XSLT 3.0 presentation." order="1" active="false"/>
      <item slug="getting-started" title="Getting Started" description="Set up PHC, autoload Xao with zero Composer packages, transform your first DomDoc with XSLT 3.0, and run phc serve." order="2" active="false"/>
    </section>
    <section name="Core Concepts">
      <item slug="architecture" title="Architecture &amp; XML Aggregation" description="How Xao builds a unified XML conglomeration document from databases, Markdown, and domain objects before delegating presentation to XSLT 3.0." order="3" active="false"/>
      <item slug="xslt-themes" title="XSLT 3.0 Themes vs CSS Skins" description="Why XSLT themes are structurally and semantically richer than CSS-only themes — including accessibility-first DOM transformations." order="4" active="false"/>
    </section>
    <section name="Framework Reference">
      <item slug="core-api" title="Core API Reference" description="Reference for Xao\\Runtime, Xao\\XaoRoot, Xao\\DomDoc, Xao\\DomFactory, Xao\\AppDoc, Xao\\Http\\Response, and Xao\\Exceptions." order="5" active="false"/>
      <item slug="database-aggregation" title="Database Aggregation (DbToXml)" description="Convert PDO queries, PDOStatement results, and PHP iterables directly into structured DomDoc XML fragments under PHC." order="6" active="false"/>
      <item slug="markdown-aggregation" title="Markdown Aggregation" description="Convert CommonMark and GFM into CommonMark XML 1.0 natively in PHC via comrak and graft it into Xao DomDoc trees." order="7" active="false"/>
      <item slug="xslt-drivers" title="XSLT 3.0 Drivers" description="Pluggable XsltDriverInterface strategies: PhcNativeXsltDriver (default in-process), SaxonHttpDriver (HTTP/distributed), and ClientSideXslDriver." order="8" active="false"/>
    </section>
    <section name="Operations &amp; Runtime">
      <item slug="phc-runtime" title="PHC Runtime &amp; Compatibility" description="Running Xao on PHC in isolate and worker modes, sandbox defaults, worker-safe autoloading, and P00–P05 compatibility findings." order="9" active="false"/>
      <item slug="security" title="Security Model" description="XXE rejection, realpath containment, strict slug allowlists, CSRF guards, gated debug output, and PHC sandbox enforcement." order="10" active="false"/>
    </section>
    <section name="Examples &amp; Design">
      <item slug="reference-apps" title="Reference Applications" description="Comparing Xao's built-in SQLite PDO catalog reference app with XaoDocs, the flat-file Markdown multi-theme CMS." order="11" active="true"/>
      <item slug="adr-0001-phc-xee-xslt" title="ADR 0001 &amp; Roadmap" description="Architecture Decision Record for pure-Rust xee-xslt in PHC plus the Xao v1.0.0 milestone and phase roadmap (M0–M3, P00–P06)." order="12" active="false"/>
    </section>
  </navigation>
  <page slug="reference-apps" title="Reference Applications" description="Comparing Xao's built-in SQLite PDO catalog reference app with XaoDocs, the flat-file Markdown multi-theme CMS." section="Examples &amp; Design" audience="Evaluators and example app authors" status="stable" words="197" reading-minutes="1" source-file="content/reference-apps.md">
    <tags>
      <tag>examples</tag>
      <tag>reference-app</tag>
      <tag>xaodocs</tag>
      <tag>sqlite</tag>
    </tags>
    <neighbors>
      <prev slug="security" title="Security Model"/>
      <next slug="adr-0001-phc-xee-xslt" title="ADR 0001 &amp; Roadmap"/>
    </neighbors>
    <body>
      <document xmlns="http://commonmark.org/xml/1.0">
        <heading level="1">
          <text xml:space="preserve">Reference Applications</text>
        </heading>
        <paragraph>
          <text xml:space="preserve">Xao demonstrates two complementary applications of the XML Conglomeration + XSLT 3.0 pattern.</text>
        </paragraph>
        <heading level="2">
          <text xml:space="preserve">1. Built-In SQLite Catalog App (</text>
          <code xml:space="preserve">Xao/public/index.php</code>
          <text xml:space="preserve">)</text>
        </heading>
        <paragraph>
          <text xml:space="preserve">Located directly inside the </text>
          <code xml:space="preserve">Xao</code>
          <text xml:space="preserve"> repository (</text>
          <code xml:space="preserve">src/App/</code>
          <text xml:space="preserve">, </text>
          <code xml:space="preserve">stylesheets/</code>
          <text xml:space="preserve">, </text>
          <code xml:space="preserve">public/index.php</code>
          <text xml:space="preserve">), this app exercises:</text>
        </paragraph>
        <list type="bullet" tight="true">
          <item>
            <paragraph>
              <code xml:space="preserve">CatalogRepository</code>
              <text xml:space="preserve"> (</text>
              <code xml:space="preserve">PDO</code>
              <text xml:space="preserve"> SQLite + </text>
              <code xml:space="preserve">DbToXml</code>
              <text xml:space="preserve">) with </text>
              <code xml:space="preserve">initializeSchema()</code>
              <text xml:space="preserve"> and </text>
              <code xml:space="preserve">seedIfEmpty()</code>
              <text xml:space="preserve">.</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <code xml:space="preserve">ReferenceApp</code>
              <text xml:space="preserve"> stateless routing (</text>
              <code xml:space="preserve">GET /</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">GET /catalog</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">GET /catalog/{slug}</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">POST /catalog/{slug}/notes</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">GET /catalog.xml</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">GET /health</code>
              <text xml:space="preserve">).</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <code xml:space="preserve">SessionManager</code>
              <text xml:space="preserve"> + </text>
              <code xml:space="preserve">CsrfGuard</code>
              <text xml:space="preserve"> for authenticated note creation.</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <code xml:space="preserve">scripts/smoke-serve.sh</code>
              <text xml:space="preserve"> testing </text>
              <code xml:space="preserve">isolate</code>
              <text xml:space="preserve"> and </text>
              <code xml:space="preserve">worker</code>
              <text xml:space="preserve"> modes with zero sidecar and </text>
              <code xml:space="preserve">allow_network = false</code>
              <text xml:space="preserve">.</text>
            </paragraph>
          </item>
        </list>
        <heading level="2">
          <text xml:space="preserve">2. XaoDocs (</text>
          <code xml:space="preserve">xao-example-apps/XaoDocs/</code>
          <text xml:space="preserve">)</text>
        </heading>
        <paragraph>
          <text xml:space="preserve">Located in the companion </text>
          <link destination="https://github.com/ndx-au/xao-example-apps" title="">
            <text xml:space="preserve">ndx-au/xao-example-apps</text>
          </link>
          <text xml:space="preserve"> repository, </text>
          <strong>
            <text xml:space="preserve">XaoDocs</text>
          </strong>
          <text xml:space="preserve"> is a flat-file Markdown CMS inspired by Sentinel's </text>
          <code xml:space="preserve">fcms</code>
          <text xml:space="preserve"> plane — and serves the very documentation you are reading:</text>
        </paragraph>
        <list type="bullet" tight="true">
          <item>
            <paragraph>
              <text xml:space="preserve">Reads </text>
              <code xml:space="preserve">content/*.md</code>
              <text xml:space="preserve"> via </text>
              <code xml:space="preserve">ContentRepository</code>
              <text xml:space="preserve"> and </text>
              <code xml:space="preserve">FrontMatterParser</code>
              <text xml:space="preserve">.</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <text xml:space="preserve">Converts Markdown to CommonMark XML 1.0 in-process via </text>
              <code xml:space="preserve">MarkdownBridge</code>
              <text xml:space="preserve"> (</text>
              <code xml:space="preserve">phc_markdown_to_dom()</code>
              <text xml:space="preserve">).</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <text xml:space="preserve">Merges site metadata, theme registry, grouped navigation, prev/next neighbors, and the CommonMark document into one </text>
              <code xml:space="preserve">&lt;xao-docs&gt;</code>
              <text xml:space="preserve"> </text>
              <code xml:space="preserve">DomDoc</code>
              <text xml:space="preserve">.</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <text xml:space="preserve">Renders five structurally distinct XSLT 3.0 themes (</text>
              <code xml:space="preserve">atlas</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">folio</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">console</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">reader</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">handbook</code>
              <text xml:space="preserve">) and exposes </text>
              <code xml:space="preserve">/xml/{slug}</code>
              <text xml:space="preserve"> to inspect the shared XML tree.</text>
            </paragraph>
          </item>
        </list>
        <code_block info="bash" xml:space="preserve">cd ../xao-example-apps/XaoDocs
../PHC/target/release/phc serve phc.toml
</code_block>
      </document>
    </body>
  </page>
</xao-docs>
