syntax-svg.xsl 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2004, 2005 IBM Corporation
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  8. xmlns:svg="http://www.w3.org/2000/svg">
  9. <!-- syntax diagram -->
  10. <!-- set up global vars and parms -->
  11. <!-- Logical containers -->
  12. <xsl:template match="*[contains(@class,' pr-d/syntaxdiagram ')]" priority="500">
  13. <svg width="200" height="100">
  14. <xsl:apply-templates/>
  15. </svg>
  16. </xsl:template>
  17. <xsl:template match="*[contains(@class,' pr-d/fragment ')]" priority="2">
  18. <div>
  19. <a><xsl:attribute name="name"><xsl:value-of select="title"/></xsl:attribute> </a>
  20. <xsl:apply-templates/>
  21. </div>
  22. </xsl:template>
  23. <xsl:template match="*[contains(@class,' pr-d/synblk ')]" priority="2">
  24. <!--span-->
  25. <xsl:call-template name="apply-for-phrases"/>
  26. <!--/span-->
  27. </xsl:template>
  28. <!-- titles for logical containers -->
  29. <xsl:template match="*[contains(@class,' pr-d/syntaxdiagram ')]/*[contains(@class,' topic/title ')]">
  30. <text style="font-size: 16; font-family: Arial; font-weight: bold; stroke:none; fill:blue;">
  31. <xsl:value-of select="."/>
  32. </text>
  33. </xsl:template>
  34. <xsl:template match="*[contains(@class,' pr-d/fragment ')]/*[contains(@class,' topic/title ')]" priority="2">
  35. <text style="font-size: 12; font-family: Arial; font-weight: bold; stroke:none; fill:blue;">
  36. <xsl:value-of select="."/>
  37. </text>
  38. </xsl:template>
  39. <!-- Basically, we want to hide his content. -->
  40. <xsl:template match="*[contains(@class,' pr-d/repsep ')]" priority="2"/>
  41. <xsl:template match="*[contains(@class,' pr-d/kwd ')]" priority="2">
  42. <text style="font-size: 11; font-family: Arial; font-weight: bold; stroke:none; fill:blue;">
  43. <xsl:if test="parent::*[contains(@class, ' pr-d/groupchoice ')]"><xsl:if test="count(preceding-sibling::*)!=0"> | </xsl:if></xsl:if>
  44. <xsl:if test="@importance='optional'"> [</xsl:if>
  45. <xsl:choose>
  46. <xsl:when test="@importance='default'"><u><xsl:value-of select="."/></u></xsl:when>
  47. <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
  48. </xsl:choose>
  49. <xsl:if test="@importance='optional'">] </xsl:if>
  50. </text>
  51. <xsl:call-template name="drawpath"/>
  52. </xsl:template>
  53. <!-- all other templates are left to fall through to the base processors;
  54. syntax diagram output requires quite different formatting than bars and braces -->
  55. </xsl:stylesheet>