home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2003 October / INTERNET108.ISO / pc / software / windows / building / xmlspy / xmlspyentcomplete5.exe / Data1.cab / _6623FCC26490470F9C9BC35A9FEEC2BB < prev    next >
Encoding:
Extensible Markup Language  |  2002-09-04  |  4.3 KB  |  122 lines

  1. <?xml version='1.0'?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3.                 xmlns:fo="http://www.w3.org/1999/XSL/Format"
  4.                 xmlns:mml="http://www.w3.org/1998/Math/MathML"
  5.                 version='1.0'>
  6.  
  7. <!-- ********************************************************************
  8.      $Id: math.xsl,v 1.1.2.1 2002/09/04 14:25:23 jdj Exp $
  9.      ********************************************************************
  10.  
  11.      This file is part of the XSL DocBook Stylesheet distribution.
  12.      See ../README or http://nwalsh.com/docbook/xsl/ for copyright
  13.      and other information.
  14.  
  15.      ******************************************************************** -->
  16.  
  17. <xsl:template match="inlineequation">
  18.   <xsl:choose>
  19.     <xsl:when test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
  20.       <xsl:apply-templates select="alt[@role='tex'] | inlinemediaobject/textobject[@role='tex']">
  21.         <xsl:with-param name="output.delims">
  22.           <xsl:call-template name="tex.math.output.delims"/>
  23.         </xsl:with-param>
  24.       </xsl:apply-templates>
  25.     </xsl:when>
  26.     <xsl:otherwise>
  27.       <xsl:apply-templates/>
  28.     </xsl:otherwise>
  29.   </xsl:choose>
  30. </xsl:template>
  31.  
  32. <xsl:template match="alt">
  33. </xsl:template>
  34.  
  35. <!-- "Support" for MathML -->
  36.  
  37. <xsl:template match="mml:*" xmlns:mml="http://www.w3.org/1998/Math/MathML">
  38.   <xsl:copy>
  39.     <xsl:copy-of select="@*"/>
  40.     <xsl:apply-templates/>
  41.   </xsl:copy>
  42. </xsl:template>
  43.  
  44. <xsl:template match="equation/mediaobject | informalequation/mediaobject">
  45.   <xsl:if test="$passivetex.extensions = 0 or $tex.math.in.alt = ''">
  46.     <fo:block>
  47.       <xsl:call-template name="select.mediaobject"/>
  48.       <xsl:apply-templates select="caption"/>
  49.     </fo:block>
  50.   </xsl:if>
  51. </xsl:template>
  52.  
  53. <xsl:template match="equation/graphic | informalequation/graphic">
  54.   <xsl:if test="$passivetex.extensions = 0 or $tex.math.in.alt = ''">
  55.     <fo:block>
  56.       <xsl:call-template name="process.image"/>
  57.     </fo:block>
  58.   </xsl:if>
  59. </xsl:template>
  60.  
  61. <xsl:template match="inlineequation/alt[@role='tex'] | 
  62.                      inlineequation/inlinemediaobject/textobject[@role='tex']" priority="1">
  63.   <xsl:param name="output.delims" select="1"/>
  64.   <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
  65.     <xsl:processing-instruction name="xmltex">
  66.       <xsl:if test="$output.delims != 0">
  67.         <xsl:text>$</xsl:text>
  68.       </xsl:if>
  69.       <xsl:value-of select="."/>
  70.       <xsl:if test="$output.delims != 0">
  71.         <xsl:text>$</xsl:text>
  72.       </xsl:if>
  73.     </xsl:processing-instruction>
  74.   </xsl:if>
  75. </xsl:template>
  76.  
  77. <xsl:template match="equation/alt[@role='tex'] | informalequation/alt[@role='tex'] |
  78.                      equation/mediaobject/textobject[@role='tex'] |
  79.                      informalequation/mediaobject/textobject[@role='tex']" priority="1">
  80.   <xsl:variable name="output.delims">
  81.     <xsl:call-template name="tex.math.output.delims"/>
  82.   </xsl:variable>
  83.   <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
  84.     <xsl:processing-instruction name="xmltex">
  85.       <xsl:if test="$output.delims != 0">
  86.         <xsl:text>$$</xsl:text>
  87.       </xsl:if>
  88.       <xsl:value-of select="."/>
  89.       <xsl:if test="$output.delims != 0">
  90.         <xsl:text>$$</xsl:text>
  91.       </xsl:if>
  92.     </xsl:processing-instruction>
  93.   </xsl:if>
  94. </xsl:template>
  95.  
  96. <xsl:template match="alt[@role='tex']">
  97.   <xsl:if test="$passivetex.extensions != 0 and $tex.math.in.alt != ''">
  98.     <xsl:message>
  99.       Your equation is misplaced. It should be in inlineequation, equation or informalequation.
  100.     </xsl:message>
  101.   </xsl:if>
  102. </xsl:template>
  103.  
  104. <xsl:template name="tex.math.output.delims">
  105.   <xsl:variable name="pi.delims">
  106.     <xsl:call-template name="pi-attribute">
  107.       <xsl:with-param name="pis" select=".//processing-instruction('dbtex')"/>
  108.       <xsl:with-param name="attribute" select="'delims'"/>
  109.     </xsl:call-template>
  110.   </xsl:variable>
  111.   <xsl:variable name="result">
  112.     <xsl:choose>
  113.       <xsl:when test="$pi.delims = 'no'">0</xsl:when>
  114.       <xsl:when test="$pi.delims = '' and $tex.math.delims = 0">0</xsl:when>
  115.       <xsl:otherwise>1</xsl:otherwise>
  116.     </xsl:choose>
  117.   </xsl:variable>
  118.   <xsl:value-of select="$result"/>
  119. </xsl:template>
  120.  
  121. </xsl:stylesheet>
  122.