Česky
Kamil Dudka

Web components

File detail

Name:DownloadPageServer.xsl [Download]
Location: src > page
Size:1.8 KB
Last modification:2007-12-11 16:09

Source code

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" omit-xml-declaration="yes"/>
  <xsl:strip-space elements="*"/>
  <!--<xsl:preserve-space elements="pre"/>
-->
 
  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>
 
  <!-- Match root element -->
  <xsl:template match="/page">
    <div id='content'>
      <xsl:comment>Begin of block generated by XSLT processor using PageServer.xsl template</xsl:comment>
      <xsl:call-template name="displayTitle"/>
      <xsl:apply-templates/>
      <xsl:comment>End of block generated by XSLT processor using PageServer.xsl template</xsl:comment>
    </div>
  </xsl:template>
 
  <!-- Display H1 using $pageTitle PHP's variable -->
  <xsl:template name="displayTitle">
    <xsl:processing-instruction name="php">
echo "  &lt;h1&gt;$pageTitle&lt;/h1&gt;\n";
</xsl:processing-instruction>
  </xsl:template>
 
  <!-- Copy MainPage element's content to output document -->
  <xsl:template match="MainPage[parent::page]">
    <xsl:apply-templates mode="copy"/>
  </xsl:template>
 
  <!-- Handle processing instruction -->
  <xsl:template match="processing-instruction('php')" mode="copy">
    <xsl:processing-instruction name="php">
      <xsl:value-of select="self::processing-instruction('php')"/>
    </xsl:processing-instruction>
  </xsl:template>
 
  <!-- Copy all content recursively -->
  <xsl:template match="*" mode="copy">
    <xsl:copy>
      <xsl:for-each select="@*">
        <xsl:copy-of select="."/>
      </xsl:for-each>
      <xsl:apply-templates mode="copy"/>
    </xsl:copy>
  </xsl:template>
 
  <!-- suppress default actions -->
  <xsl:template match="*" />
 
</xsl:stylesheet>