svg-d.xsl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2018 Jarno Elovirta
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <xsl:stylesheet version="2.0"
  8. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. xmlns:dita-ot="http://dita-ot.sourceforge.net/ns/201007/dita-ot"
  10. xmlns:svg="http://www.w3.org/2000/svg"
  11. exclude-result-prefixes="dita-ot svg">
  12. <xsl:template match="*[contains(@class, ' svg-d/svgref ')]" name="topic.svg-d.svgref">
  13. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-startprop ')]" mode="out-of-line"/>
  14. <img>
  15. <xsl:call-template name="commonattributes"/>
  16. <xsl:call-template name="setid"/>
  17. <xsl:apply-templates select="@href"/>
  18. </img>
  19. <xsl:apply-templates select="*[contains(@class, ' ditaot-d/ditaval-endprop ')]" mode="out-of-line"/>
  20. <!-- image name for review -->
  21. <xsl:if test="$ARTLBL = 'yes'"> [<xsl:value-of select="@href"/>] </xsl:if>
  22. </xsl:template>
  23. <xsl:template match="*[contains(@class, ' svg-d/svgref ')]/@href">
  24. <xsl:attribute name="src" select="."/>
  25. </xsl:template>
  26. <xsl:template match="*[contains(@class, ' svg-d/svg-container ')]" name="topic.svg-d.svg-container">
  27. <xsl:call-template name="setaname"/>
  28. <xsl:apply-templates/>
  29. </xsl:template>
  30. <xsl:template match="svg:svg">
  31. <xsl:apply-templates select="." mode="dita-ot:svg-prefix"/>
  32. </xsl:template>
  33. <xsl:template match="svg:*" mode="dita-ot:svg-prefix" priority="10">
  34. <xsl:element name="{local-name()}" namespace="http://www.w3.org/2000/svg">
  35. <xsl:apply-templates select="@* | node()" mode="dita-ot:svg-prefix"/>
  36. </xsl:element>
  37. </xsl:template>
  38. <xsl:template match="@* | node()" mode="dita-ot:svg-prefix">
  39. <xsl:copy>
  40. <xsl:apply-templates select="@* | node()" mode="dita-ot:svg-prefix"/>
  41. </xsl:copy>
  42. </xsl:template>
  43. </xsl:stylesheet>