job-helper.xsl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2013 Jarno Elovirta
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  8. version="2.0">
  9. <xsl:output method="text"/>
  10. <xsl:param name="property"/>
  11. <xsl:template match="/">
  12. <xsl:variable name="prop" select="job/property[@name = $property]"/>
  13. <xsl:choose>
  14. <xsl:when test="$prop">
  15. <xsl:apply-templates select="$prop/*"/>
  16. </xsl:when>
  17. <xsl:when test="$property = 'canditopicslist'">
  18. <xsl:apply-templates select="job/files/file[@non-conref-target = 'true']"/>
  19. </xsl:when>
  20. <xsl:when test="$property = 'codereflist'">
  21. <xsl:apply-templates select="job/files/file[@has-coderef = 'true']"/>
  22. </xsl:when>
  23. <xsl:when test="$property = 'conreflist'">
  24. <xsl:apply-templates select="job/files/file[@has-conref = 'true']"/>
  25. </xsl:when>
  26. <xsl:when test="$property = 'conrefpushlist'">
  27. <xsl:apply-templates select="job/files/file[@conrefpush = 'true']"/>
  28. </xsl:when>
  29. <xsl:when test="$property = 'conreftargetslist'">
  30. <xsl:apply-templates select="job/files/file[@conref-target = 'true']"/>
  31. </xsl:when>
  32. <xsl:when test="$property = 'copytosourcelist'">
  33. <xsl:apply-templates select="job/files/file[@copy-to-source = 'true']"/>
  34. </xsl:when>
  35. <xsl:when test="$property = 'flagimagelist'">
  36. <xsl:apply-templates select="job/files/file[@flag-image = 'true']"/>
  37. </xsl:when>
  38. <xsl:when test="$property = 'fullditamaplist'">
  39. <xsl:apply-templates select="job/files/file[@format = 'ditamap']"/>
  40. </xsl:when>
  41. <xsl:when test="$property = 'fullditamapandtopiclist'">
  42. <xsl:apply-templates select="job/files/file[(@format = 'ditamap' or @format = 'dita')]"/>
  43. </xsl:when>
  44. <xsl:when test="$property = 'fullditatopiclist'">
  45. <xsl:apply-templates select="job/files/file[@format = 'dita']"/>
  46. </xsl:when>
  47. <xsl:when test="$property = 'hrefditatopiclist'">
  48. <xsl:apply-templates select="job/files/file[@has-link = 'true']"/>
  49. </xsl:when>
  50. <xsl:when test="$property = 'hreftargetslist'">
  51. <xsl:apply-templates select="job/files/file[@target = 'true']"/>
  52. </xsl:when>
  53. <!-- Deprecated since 2.2 -->
  54. <xsl:when test="$property = 'htmllist'">
  55. <xsl:apply-templates select="job/files/file[@format = 'html']"/>
  56. </xsl:when>
  57. <!-- Deprecated since 2.2 -->
  58. <xsl:when test="$property = 'imagelist'">
  59. <xsl:apply-templates select="job/files/file[@format = 'image']"/>
  60. </xsl:when>
  61. <xsl:when test="$property = 'keyreflist'">
  62. <xsl:apply-templates select="job/files/file[@has-keyref = 'true']"/>
  63. </xsl:when>
  64. <xsl:when test="$property = 'outditafileslist'">
  65. <xsl:apply-templates select="job/files/file[@out-dita = 'true']"/>
  66. </xsl:when>
  67. <xsl:when test="$property = 'resourceonlylist'">
  68. <xsl:apply-templates select="job/files/file[@resource-only = 'true']"/>
  69. </xsl:when>
  70. <xsl:when test="$property = 'subjectschemelist'">
  71. <xsl:apply-templates select="job/files/file[@subjectscheme = 'true']"/>
  72. </xsl:when>
  73. <xsl:when test="$property = 'subtargetslist'">
  74. <xsl:apply-templates select="job/files/file[@subtarget = 'true']"/>
  75. </xsl:when>
  76. <xsl:otherwise>
  77. <xsl:message terminate="yes">ERROR: Unrecognized property '<xsl:value-of select="$property"/>'</xsl:message>
  78. </xsl:otherwise>
  79. </xsl:choose>
  80. </xsl:template>
  81. <xsl:template match="set">
  82. <xsl:for-each select="string">
  83. <xsl:if test="not(position() = 1)"><xsl:text>&#xA;</xsl:text></xsl:if>
  84. <xsl:apply-templates select="."/>
  85. </xsl:for-each>
  86. </xsl:template>
  87. <xsl:template match="string">
  88. <xsl:value-of select="."/>
  89. </xsl:template>
  90. <xsl:template match="file">
  91. <xsl:if test="not(position() = 1)"><xsl:text>&#xA;</xsl:text></xsl:if>
  92. <xsl:value-of select="@path"/>
  93. </xsl:template>
  94. </xsl:stylesheet>