<?xml version="1.0" encoding="utf-8"?>

<!--
This is an XSL stylesheet which converts mscript XML files into FO
Use the XSLT command to perform the conversion.

This is intended to be included inside another XSL file, not used standalone.

When EntityResolvers work properly, this should be moved to its own directory.

Copyright 1984-2002 The MathWorks, Inc.
$Revision: 1.1.8.1 $  $Date: 2004/08/17 21:27:49 $
-->

<xsl:stylesheet
  version="1.0"
  xmlns:xsl  = "http://www.w3.org/1999/XSL/Transform"
  xmlns:fo   = "http://www.w3.org/1999/XSL/Format"
  xmlns:mwsh = "http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">
  <xsl:param name="code.keyword">blue</xsl:param>
  <xsl:param name="code.comment">green</xsl:param>
  <xsl:param name="code.string">#B20000</xsl:param>
  <xsl:param name="code.untermstring">purple</xsl:param>
  <xsl:param name="code.syscmd">orange</xsl:param>
  <xsl:strip-space elements="mwsh:code"/>

<!--wrap-option='no-wrap'-->
<xsl:template match="mwsh:code"><fo:block 
                white-space-collapse='false'
                linefeed-treatment="preserve"
                xsl:use-attribute-sets="monospace.verbatim.properties"><xsl:apply-templates/></fo:block></xsl:template>

<xsl:template match="mwsh:keywords">
  <fo:inline color="{$code.keyword}"><xsl:value-of select="."/></fo:inline>
</xsl:template>

<xsl:template match="mwsh:strings">
  <fo:inline color="{$code.string}"><xsl:value-of select="."/></fo:inline>
</xsl:template>

<xsl:template match="mwsh:comments">
  <fo:inline color="{$code.comment}"><xsl:value-of select="."/></fo:inline>
</xsl:template>

<xsl:template match="mwsh:unterminated_strings">
  <fo:inline color="{$code.untermstring}"><xsl:value-of select="."/></fo:inline>
</xsl:template>

<xsl:template match="mwsh:system_commands">
  <fo:inline color="{$code.syscmd}"><xsl:value-of select="."/></fo:inline>
</xsl:template>

</xsl:stylesheet>

