validate-recipe.xsl 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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="'add-recipe'"/>
  10. <!-- helper vars -->
  11. <xsl:variable name="recipe" select="xweb:x-data/xweb:x-model/eat:edit/eat:recipe"/>
  12. <xsl:variable name="is-new" select="not(boolean($recipe/@recipeId))"/>
  13. <xsl:template match="xweb:x-data" mode="page-title">
  14. <xsl:choose>
  15. <xsl:when test="$is-new = 'false'">
  16. <xsl:value-of select="key('i18n','edit-recipe.edit.validate.title')"/>
  17. </xsl:when>
  18. <xsl:otherwise>
  19. <xsl:value-of select="key('i18n','edit-recipe.create.validate.title')"/>
  20. </xsl:otherwise>
  21. </xsl:choose>
  22. </xsl:template>
  23. <xsl:template match="xweb:x-data" mode="page-body">
  24. <div class="intro">
  25. <xsl:choose>
  26. <xsl:when test="$is-new = 'false'">
  27. <xsl:value-of select="key('i18n','edit-recipe.edit.validate.intro')"
  28. disable-output-escaping="yes"/>
  29. </xsl:when>
  30. <xsl:otherwise>
  31. <xsl:value-of select="key('i18n','edit-recipe.create.validate.intro')"
  32. disable-output-escaping="yes"/>
  33. </xsl:otherwise>
  34. </xsl:choose>
  35. </div>
  36. <xsl:apply-templates select="$recipe" mode="display"/>
  37. <form method="post" action="{$web-context}{$ctx/xweb:path}">
  38. <input type="submit" name="_finish" value="{key('i18n','save.displayName')}"/>
  39. <xsl:text> </xsl:text>
  40. <input type="submit" value="{key('i18n','reedit.displayName')}">
  41. <xsl:choose>
  42. <xsl:when test="$is-new = 'true'">
  43. <xsl:attribute name="name">_target1</xsl:attribute>
  44. </xsl:when>
  45. <xsl:otherwise>
  46. <xsl:attribute name="name">_target0</xsl:attribute>
  47. </xsl:otherwise>
  48. </xsl:choose>
  49. </input>
  50. </form>
  51. </xsl:template>
  52. </xsl:stylesheet>