choose-meal-for-recipe.xsl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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','choose-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','choose-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. <form method="post" action="{$web-context}{$ctx/xweb:path}">
  29. <table class="form">
  30. <tr>
  31. <th>
  32. <xsl:value-of select="key('i18n','meal.displayName')"/>
  33. </th>
  34. <td>
  35. <select name="meal.mealId">
  36. <xsl:apply-templates select="$aux/*/eat:meal"/>
  37. </select>
  38. </td>
  39. </tr>
  40. <tr>
  41. <th>
  42. <xsl:value-of select="key('i18n','recipe.course.displayName')"/>
  43. </th>
  44. <td>
  45. <select name="mealRecipe.course.courseId">
  46. <xsl:apply-templates select="$aux/*/eat:course"/>
  47. </select>
  48. <br/>
  49. <span class="caption">
  50. <xsl:value-of select="key('i18n','mealRecipe.course.caption')"/>
  51. </span>
  52. </td>
  53. </tr>
  54. <tr>
  55. <th>
  56. <xsl:if test="$err[@field='mealRecipe.quantity']">
  57. <xsl:attribute name="class">error</xsl:attribute>
  58. </xsl:if>
  59. <xsl:value-of select="key('i18n','mealRecipe.quantity.displayName')"/>
  60. </th>
  61. <td>
  62. <input type="text" name="mealRecipe.quantity"
  63. value="{$meal-recipe/@quantity}" class="vsmallnum"/>
  64. <br/>
  65. <span class="caption">
  66. <xsl:value-of select="key('i18n','mealRecipe.quantity.caption')"
  67. disable-output-escaping="yes"/>
  68. </span>
  69. </td>
  70. </tr>
  71. <tr>
  72. <th/>
  73. <td>
  74. <input type="submit" name="_target1" value="{key('i18n','continue.displayName')}"/>
  75. <xsl:text> </xsl:text>
  76. <input type="submit" name="_cancel" value="{key('i18n','cancel.displayName')}"/>
  77. </td>
  78. </tr>
  79. </table>
  80. </form>
  81. </xsl:template>
  82. <xsl:template match="eat:meal">
  83. <option value="{@mealId}">
  84. <xsl:if test="@mealId = $meal/@mealId">
  85. <xsl:attribute name="selected">selected</xsl:attribute>
  86. </xsl:if>
  87. <xsl:value-of select="eat:name"/>
  88. </option>
  89. </xsl:template>
  90. <xsl:template match="eat:course">
  91. <option value="{@courseId}">
  92. <xsl:if test="@courseId = $meal-recipe/eat:course/@courseId">
  93. <xsl:attribute name="selected">selected</xsl:attribute>
  94. </xsl:if>
  95. <xsl:value-of select="."/>
  96. </option>
  97. </xsl:template>
  98. </xsl:stylesheet>