<?xml version="1.0"?>
<!--
  This stylesheet is not used directly, but rather is processed by
  xmllint with xinclude in order to "insert" the php code from the
  file search.php.inc.

  It processes a "generic" documentation page (search.templ) which
  is produced by api.xsl, changes it from xhtml to html (because of
  php limitations), and inserts the php code at the "right spot".
  This "right spot" is a unique element generated by api.xsl with
  the tag name "insert_php".  This script replaces that element.
  In order to avoid parsing problems, php code is contained within
  a <xsl:text disable-output-escaping="yes"> node.
-->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xi="http://www.w3.org/2003/XInclude"
  exclude-result-prefixes="xhtml xi">

  <xsl:output method="xml" omit-xml-declaration="yes"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
    doctype-system="http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"/>

  <!-- The <html> element is the root for our processing -->
  <xsl:template match="xhtml:html">
    <html>
      <xsl:apply-templates/>
    </html>
  </xsl:template>

  <!-- api.xsl has put a dummy tag at the insert point -->
  <xsl:template match="xhtml:insert_php">
    <xsl:text disable-output-escaping="yes">
<!-- This will be replaced with the php code -->
<xi:include parse="text" href="search.php.inc"/>
    </xsl:text>
  </xsl:template>

  <!-- anything else just gets copied out -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>
