root-processing_xep.xsl 1.7 KB

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