syntax-svg.xsl 2.5 KB

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