choicetable.xsl 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- This file is part of the DITA Open Toolkit project.
  3. See the accompanying license.txt file for applicable licenses. -->
  4. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  6. xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
  7. xmlns:table="http://dita-ot.sourceforge.net/ns/201007/dita-ot/table"
  8. xmlns:simpletable="http://dita-ot.sourceforge.net/ns/201007/dita-ot/simpletable"
  9. version="2.0"
  10. exclude-result-prefixes="xs dita-ot table simpletable">
  11. <xsl:template mode="generate-table-header" match="
  12. *[contains(@class,' task/choicetable ')]
  13. [empty(*[contains(@class,' task/chhead ')])]
  14. ">
  15. <chhead class="- topic/sthead task/chhead ">
  16. <choptionhd class="- topic/stentry task/choptionhd ">
  17. <xsl:attribute name="id" select="simpletable:generate-headers(., 'option')"/>
  18. <xsl:sequence select="dita-ot:get-variable(., 'Option')"/>
  19. </choptionhd>
  20. <chdeschd class="- topic/stentry task/chdeschd ">
  21. <xsl:attribute name="id" select="simpletable:generate-headers(., 'desc')"/>
  22. <xsl:sequence select="dita-ot:get-variable(., 'Description')"/>
  23. </chdeschd>
  24. </chhead>
  25. </xsl:template>
  26. <xsl:template mode="headers" match="
  27. *[contains(@class,' task/choption ')]
  28. [empty(simpletable:get-current-table(.)/*[contains(@class,' task/chhead ')])]
  29. ">
  30. <xsl:attribute name="headers" select="
  31. simpletable:generate-headers(simpletable:get-current-table(.), 'option')
  32. "/>
  33. </xsl:template>
  34. <xsl:template mode="headers" match="
  35. *[contains(@class,' task/chdesc ')]
  36. [empty(simpletable:get-current-table(.)/*[contains(@class,' task/chhead ')])]
  37. ">
  38. <xsl:attribute name="headers" select="
  39. simpletable:generate-headers(simpletable:get-current-table(.), 'desc')
  40. "/>
  41. </xsl:template>
  42. </xsl:stylesheet>