root-processing_xep.xsl 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2012 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. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  9. xmlns:fo="http://www.w3.org/1999/XSL/Format"
  10. xmlns:rx="http://www.renderx.com/XSL/Extensions"
  11. xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
  12. version="2.0" exclude-result-prefixes="dita-ot xs">
  13. <xsl:template name="createMetadata">
  14. <rx:meta-info>
  15. <xsl:variable name="title" as="xs:string?">
  16. <xsl:apply-templates select="." mode="dita-ot:title-metadata"/>
  17. </xsl:variable>
  18. <xsl:if test="exists($title)">
  19. <rx:meta-field name="title" value="{$title}"/>
  20. </xsl:if>
  21. <xsl:variable name="author" as="xs:string?">
  22. <xsl:apply-templates select="." mode="dita-ot:author-metadata"/>
  23. </xsl:variable>
  24. <xsl:if test="exists($author)">
  25. <rx:meta-field name="author" value="{$author}"/>
  26. </xsl:if>
  27. <xsl:variable name="keywords" as="xs:string*">
  28. <xsl:apply-templates select="." mode="dita-ot:keywords-metadata"/>
  29. </xsl:variable>
  30. <xsl:if test="exists($keywords)">
  31. <rx:meta-field name="keywords">
  32. <xsl:attribute name="value" select="$keywords" separator=", "/>
  33. </rx:meta-field>
  34. </xsl:if>
  35. <xsl:variable name="subject" as="xs:string?">
  36. <xsl:apply-templates select="." mode="dita-ot:subject-metadata"/>
  37. </xsl:variable>
  38. <xsl:if test="exists($subject)">
  39. <rx:meta-field name="subject" value="{$subject}"/>
  40. </xsl:if>
  41. <rx:meta-field name="creator" value="DITA Open Toolkit"/>
  42. </rx:meta-info>
  43. </xsl:template>
  44. </xsl:stylesheet>