default-layout.xsl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  3. xmlns:eat="http://msqr.us/xsd/ieat"
  4. xmlns:xweb="http://msqr.us/xsd/jaxb-web"
  5. exclude-result-prefixes="eat xweb">
  6. <!-- imports -->
  7. <xsl:import href="display-recipe.xsl"/>
  8. <xsl:import href="global.xsl"/>
  9. <xsl:output method="xml" omit-xml-declaration="no"
  10. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  11. doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"/>
  12. <!--
  13. Layout Stylesheet
  14. This stylesheet is not designed to be used directly, rather it should be
  15. imported or included into another stylesheet. That stylesheet must define
  16. the following variables:
  17. layout.global.nav.page: the current global nav page
  18. The layout of this template is as roughly as follows:
  19. +============================================================+
  20. | PAGE-TITLE PAGE-GLOBAL-NAV |
  21. | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
  22. | RETURN-NAV ACTION-LINKS |
  23. | ACTION-LINKS-2 |
  24. | PAGE-BODY |
  25. | |
  26. | PAGE-FOOTER |
  27. +============================================================+
  28. Thus implementing stylesheets should define templates that match
  29. the xweb:x-data element for the mode of the elements outlined
  30. above (the modes should be lower-case). This stylesheet does
  31. provide defaults for some of these elements, so to override
  32. those defaults you must import this stylesheet rather than
  33. include it.
  34. -->
  35. <xsl:template match="xweb:x-data">
  36. <xsl:variable name="layout.page.title">
  37. <xsl:apply-templates select="." mode="page-title"/>
  38. </xsl:variable>
  39. <html>
  40. <head profile="{$web-context}/profile.txt?lang={$ctx/xweb:user-locale}">
  41. <title><xsl:value-of select="$layout.page.title"/></title>
  42. <link rel="stylesheet" type="text/css" href="{$web-context}/css/global.css" media="screen,print"/>
  43. <link rel="stylesheet" type="text/css" href="{$web-context}/css/print.css" media="print"/>
  44. <xsl:apply-templates select="." mode="page-head-content"/>
  45. </head>
  46. <body>
  47. <xsl:apply-templates select="." mode="page-global-nav"/>
  48. <h1><xsl:value-of select="$layout.page.title"/></h1>
  49. <!-- Only output the edit-banner <div> if some content is generated for it -->
  50. <xsl:variable name="layout.action.links">
  51. <xsl:apply-templates select="." mode="action-links"/>
  52. </xsl:variable>
  53. <xsl:if test="string($layout.action.links)">
  54. <div class="edit-banner">
  55. <xsl:copy-of select="$layout.action.links"/>
  56. </div>
  57. </xsl:if>
  58. <!-- Only output the edit-banner-2 <div> if some content is generated for it -->
  59. <xsl:variable name="layout.action.links.2">
  60. <xsl:apply-templates select="." mode="action-links-2"/>
  61. </xsl:variable>
  62. <xsl:if test="string($layout.action.links.2)">
  63. <div class="edit-banner-2">
  64. <xsl:copy-of select="$layout.action.links.2"/>
  65. </div>
  66. </xsl:if>
  67. <xsl:call-template name="error-intro">
  68. <xsl:with-param name="errors-node" select="xweb:x-errors"/>
  69. </xsl:call-template>
  70. <xsl:apply-templates select="." mode="page-body"/>
  71. <xsl:apply-templates select="." mode="page-footer"/>
  72. </body>
  73. </html>
  74. </xsl:template>
  75. <!-- Layout Template: page-title
  76. Render the browser page title as well as the main heading. This should
  77. return a simple string, without any markup.
  78. -->
  79. <xsl:template match="xweb:x-data" mode="page-title">
  80. <xsl:value-of select="key('i18n','title')"/>
  81. </xsl:template>
  82. <xsl:template match="xweb:x-data" mode="page-global-nav">
  83. <xsl:call-template name="global-nav">
  84. <xsl:with-param name="page" select="$layout.global.nav.page"/>
  85. </xsl:call-template>
  86. </xsl:template>
  87. <xsl:template match="xweb:x-data" mode="page-head-content"/>
  88. <xsl:template match="xweb:x-data" mode="action-links"/>
  89. <xsl:template match="xweb:x-data" mode="action-links-2"/>
  90. <xsl:template match="xweb:x-data" mode="page-body"/>
  91. <xsl:template match="xweb:x-data" mode="page-footer"/>
  92. </xsl:stylesheet>