xhtml2xhtml5.xsl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2. xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias"
  3. version="1.0">
  4. <xsl:output indent="no" method="xml"/>
  5. <xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>
  6. <xsl:template match="node()|@*">
  7. <xsl:copy>
  8. <xsl:apply-templates select="@*"/>
  9. <xsl:apply-templates/>
  10. </xsl:copy>
  11. </xsl:template>
  12. <xsl:template match="xsl:output">
  13. <xsl:comment>Same as xhtml but with doctypes removed from xsl:output </xsl:comment>
  14. <xsl:text>&#10;</xsl:text>
  15. <xsl:comment>and including from ../xhtml directory </xsl:comment>
  16. <xsl:text>&#10;</xsl:text>
  17. <xslo:output method="xml" encoding="UTF-8" indent="no"/>
  18. </xsl:template>
  19. <xsl:template match="xsl:include/@href">
  20. <xsl:choose>
  21. <xsl:when test="starts-with(., '../')">
  22. <xsl:copy-of select="."/>
  23. </xsl:when>
  24. <xsl:otherwise>
  25. <xsl:attribute name="href">
  26. <xsl:value-of select="concat('../xhtml/', .)"/>
  27. </xsl:attribute>
  28. </xsl:otherwise>
  29. </xsl:choose>
  30. </xsl:template>
  31. <xsl:template match="comment()
  32. [starts-with(string(.), 'This file was created automatically')]">
  33. <xsl:text>&#10;</xsl:text>
  34. <xsl:comment>This file was created automatically by xhtml2xhtml5.xsl from the xhtml stylesheet.</xsl:comment>
  35. <xsl:text>&#10;</xsl:text>
  36. </xsl:template>
  37. <xsl:template match="comment()
  38. [starts-with(string(.), 'from the HTML stylesheets')]"/>
  39. <xsl:include href="../common/subtitles.xsl"/>
  40. </xsl:stylesheet>