validate-meal-for-recipe.xsl 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  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="tmpl/default-layout.xsl"/>
  8. <!-- layout variables -->
  9. <xsl:variable name="layout.global.nav.page" select="''"/>
  10. <!-- helper vars -->
  11. <xsl:variable name="meal" select="xweb:x-data/xweb:x-model/eat:edit/eat:meal"/>
  12. <xsl:variable name="meal-recipe" select="xweb:x-data/xweb:x-model/eat:edit/eat:meal-recipe"/>
  13. <xsl:template match="xweb:x-data" mode="page-title">
  14. <xsl:value-of select="key('i18n','validate-meal-for-recipe.title')"/>
  15. </xsl:template>
  16. <xsl:template match="xweb:x-data" mode="page-body">
  17. <div class="intro">
  18. <xsl:value-of select="key('i18n','validate-meal-for-recipe.intro')" disable-output-escaping="yes"/>
  19. </div>
  20. <div class="formLabel">
  21. <xsl:value-of select="key('i18n','recipe.displayName')"/>
  22. <xsl:text>: </xsl:text>
  23. </div>
  24. <div class="read-only">
  25. <xsl:value-of select="$meal-recipe/eat:recipe/eat:name"/>
  26. </div>
  27. <br clear="left" />
  28. <table class="view">
  29. <tr>
  30. <th>
  31. <xsl:value-of select="key('i18n','meal.displayName')"/>
  32. </th>
  33. <td colspan="3">
  34. <xsl:value-of select="$aux/*/eat:meal[@mealId = $meal/@mealId]/eat:name"/>
  35. </td>
  36. </tr>
  37. <tr>
  38. <th>
  39. <xsl:value-of select="key('i18n','recipe.course.displayName')"/>
  40. </th>
  41. <td>
  42. <xsl:value-of select="$aux/*/eat:course[@courseId = $meal-recipe/eat:course/@courseId]"/>
  43. </td>
  44. </tr>
  45. <tr>
  46. <th>
  47. <xsl:value-of select="key('i18n','mealRecipe.quantity.displayName')"/>
  48. </th>
  49. <td>
  50. <xsl:value-of select="$meal-recipe/@quantity"/>
  51. </td>
  52. </tr>
  53. </table>
  54. <br/>
  55. <form method="post" action="{$web-context}{$ctx/xweb:path}">
  56. <input type="submit" name="_finish" value="{key('i18n','save.displayName')}"/>
  57. <xsl:text> </xsl:text>
  58. <input type="submit" name="_target0" value="{key('i18n','reedit.displayName')}"/>
  59. </form>
  60. </xsl:template>
  61. <xsl:template match="eat:meal">
  62. <option value="{@mealId}">
  63. <xsl:if test="@mealId = $meal/@mealId">
  64. <xsl:attribute name="selected">selected</xsl:attribute>
  65. </xsl:if>
  66. <xsl:value-of select="eat:name"/>
  67. </option>
  68. </xsl:template>
  69. <xsl:template match="eat:course">
  70. <option value="{@courseId}">
  71. <xsl:if test="@courseId = $meal-recipe/eat:course/@courseId">
  72. <xsl:attribute name="selected">selected</xsl:attribute>
  73. </xsl:if>
  74. <xsl:value-of select="."/>
  75. </option>
  76. </xsl:template>
  77. </xsl:stylesheet>