Sourcecode Listing of

http://purl.oclc.org/NEUMES/ref/NeumesXSLT_utils.xsl





Color Key :   [•] XML code      [•] HTML      [•] symbol substitution      [•] XML comment   

Line
0001 <?xml version='1.0' encoding="UTF-8" standalone="no"?>
0002 <!--
0003 *   XML Transformation (XSLT) generated on 22 June 2006.
0004 *   Filename: http://www.scribeserver.com/NEUMES/xml/NeumesXSLT_utils.xsl
0005 *   Version: 1.1.e
0006 *   Owner: The NEUMES Project
0007 *   (Neumed and Ecphonetic Universal Manuscript Encoding Standard).
0008 *   For details see, http://purl.oclc.org/SCRIBE/NEUMES/
0009 *   Author: Louis W. G. Barton, with Jeni Tennison.
0010 *   Type: XML XSLT
0011 -->
0012 
0013 <!--   NeumesXML utilities for XSLT
0014    This is a non-standalone battery of XSLT utilities for manipulating the
0015    content of NeumesXML files that conform to NeumesXML version 2 Schema
0016    format. Dependencies: the XSLT Variables used by these utilities are
0017    passed as parameters;</span> this file depends on the NEUMES codepoints and
0018    codepoint ranges;</span> these utilities produce no output. NeumesXML is an
0019    XML application for describing medieval chant manuscript sources and
0020    transcribing their content to digital data in NEUMES format (Neumed
0021    and Ecphonetic Universal Manuscript Encoding Standard).
0022 
0023    Protected by law under one or more of the following copyrights:
0024    Copyright 2005, The University of Oxford.
0025    Copyright 2003-2005, Louis W. G. Barton.
0026    Copyright 2002-2003, The President and Fellows of Harvard College;</span>
0027    contains software or other intellectual property licensed from
0028    Louis W. G. Barton, copyright 1995-2001 by Louis W. G. Barton.
0029 
0030    The copyright holders grant royalty-free license to transmit, display,
0031    perform and/or distribute without modification the NeumeXML version 2
0032    Schema and its accompanying documentation for non-commercial educational,
0033    cultural, and charitable uses, provided that the above copyright notice
0034    and this paragraph appear in all copies. The copyright holders make no
0035    representation about the suitability of the Schema and its accompanying
0036    documentation for any purpose. It is provided "as is" without expressed
0037    or implied warranty.
0038 -->
0039 
0040 <!DOCTYPE xsl:stylesheet SYSTEM "http://www.scribeserver.com/NEUMES/xml/NeumesXML_xsl.dtd" [
0041 <!-- *** NeumesXML_xsl.dtd includes NEUMES codepoint declarations. *** -->
0042 <!-- Insert stylesheet-specific Entity declarations here. -->
0043 ]>
0044 
0045 <xsl:stylesheet version="1.0"
0046    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
0047    xmlns:nxm="http://www.scribeserver.com/NEUMES/xml/NeumesXML"
0048 >
0049 <!--[end, Root Element]-->
0050 
0051 
0052 <!--   *****************
0053    **  UTILITIES  **
0054    *****************
0055 NOTE: See the accompanying documentation file at,
0056 http://purl.oclc.org/NEUMES/ref/NeumesXSLT_doc.htm
0057 -->
0058 
0059 <!-- Programmer's notes:
0060 * Re-order glyph names alphabetically, not in taxonomic order.
0061 -->
0062 
0063 <!--   *********************************
0064    **  GET TONAL MOVEMENT BOUNDS  **
0065 
0066 Recursive template finds the lower bound and upper bound of the cumulative tonal movement
0067 for the *neumeNodeList* (by default, all <neume> nodes in this <transcription>).
0068 These data typically are used as a "floor" and "ceiling" in establishing a baseline offset
0069 (in pixels) of the initial glyph for visualization.
0070 -->
0071 <xsl:template name="GetTonalMvmtBounds">
0072    <xsl:param name="neumeNodeList" select="//nxm:neume"/> <!--default value-->
0073    <xsl:param name="tonalMvmtAggregate" select="0"/> <!--default value-->
0074    <xsl:param name="tonalMvmtFloor" select="0"/> <!--default value-->
0075    <xsl:param name="tonalMvmtCeiling" select="0"/> <!--default value-->
0076 
0077    <xsl:choose>
0078    <xsl:when test="$neumeNodeList"> <!--if false [end of list], then fall through-->
0079       <!-- Aggregate this <neume> (movement is relative to *tonalMvmtAggregate*): -->
0080       <xsl:variable name="multiVal"> <!--a multi-valued string is generated-->
0081          <xsl:call-template name="AggregateHeights">
0082             <xsl:with-param name="sequenceToParse"
0083                select="$neumeNodeList[1]/text()"/>
0084             <!-- If UNK Mvmt, then *localMvmtAggregate* is since last UNK: -->
0085             <xsl:with-param name="localMvmtAggregate" select="0"/>
0086             <!-- *localMvmtFloor* is local minimum: -->
0087             <xsl:with-param name="localMvmtFloor" select="0"/>
0088             <!-- *localMvmtCeiling* is local maximum: -->
0089             <xsl:with-param name="localMvmtCeiling" select="0"/>
0090             <!-- resetFlag of 888 = there was an UNK Mvmt: -->
0091             <xsl:with-param name="resetFlag" select="''"/>
0092          </xsl:call-template>
0093       </xsl:variable>
0094       <!-- unpack *multiVal* (comma-delimited string): -->
0095       <xsl:variable name="localAggregate" select="substring-before($multiVal, ',')"/>
0096       <xsl:variable name="tempStr1" select="substring-after($multiVal, ',')"/>
0097       <xsl:variable name="trialFloor" select="substring-before($tempStr1, ',')"/>
0098       <xsl:variable name="tempStr2" select="substring-after($tempStr1, ',')"/>
0099       <xsl:variable name="trialCeiling" select="substring-before($tempStr2, ',')"/>
0100       <xsl:variable name="resetFlag" select="substring-after($tempStr2, ',')"/>
0101 
0102       <!-- Handle cases: -->
0103       <xsl:choose>
0104       <!-- Case 1. UNK Tonal Movement in the neume: -->
0105       <xsl:when test="$resetFlag = 888">
0106          <!--   Treat *trialFloor* and *trialFloor* as movements from 0 [no addition];
0107             reset *tonalMvmtAggregate* to *localAggregate*:
0108          -->
0109          <xsl:choose>
0110          <!-- Case 1a. no new floor AND no new ceiling: -->
0111          <xsl:when test="($trialFloor >= $tonalMvmtFloor) and
0112             ($tonalMvmtCeiling >= $trialCeiling)">
0113             <xsl:call-template name="GetTonalMvmtBounds"> <!--recurse-->
0114                <!-- Select all nodes in this context after first node: -->
0115                <xsl:with-param name="neumeNodeList"
0116                   select="$neumeNodeList[position() > 1]"/>
0117                <xsl:with-param name="tonalMvmtAggregate"
0118                   select="$localAggregate"/>
0119                <xsl:with-param name="tonalMvmtFloor"
0120                   select="$tonalMvmtFloor"/>
0121                <xsl:with-param name="tonalMvmtCeiling"
0122                   select="$tonalMvmtCeiling"/>
0123             </xsl:call-template>
0124          </xsl:when>
0125          <!-- Case 1b. new floor AND no new ceiling: -->
0126          <xsl:when test="($tonalMvmtFloor > $trialFloor) and
0127             ($tonalMvmtCeiling >= $trialCeiling)">
0128             <xsl:call-template name="GetTonalMvmtBounds"> <!--recurse-->
0129                <!-- Select all nodes in this context after first node: -->
0130                <xsl:with-param name="neumeNodeList"
0131                   select="$neumeNodeList[position() > 1]"/>
0132                <xsl:with-param name="tonalMvmtAggregate"
0133                   select="$localAggregate"/>
0134                <xsl:with-param name="tonalMvmtFloor"
0135                   select="$trialFloor"/>
0136                <xsl:with-param name="tonalMvmtCeiling"
0137                   select="$tonalMvmtCeiling"/>
0138             </xsl:call-template>
0139          </xsl:when>
0140          <!-- Case 1c. no new floor AND new ceiling: -->
0141          <xsl:when test="($trialFloor >= $tonalMvmtFloor) and
0142             ($trialCeiling > $tonalMvmtCeiling)">
0143             <xsl:call-template name="GetTonalMvmtBounds"> <!--recurse-->
0144                <!-- Select all nodes in this context after first node: -->
0145                <xsl:with-param name="neumeNodeList"
0146                   select="$neumeNodeList[position() > 1]"/>
0147                <xsl:with-param name="tonalMvmtAggregate"
0148                   select="$localAggregate"/>
0149                <xsl:with-param name="tonalMvmtFloor"
0150                   select="$tonalMvmtFloor"/>
0151                <xsl:with-param name="tonalMvmtCeiling"
0152                   select="$trialCeiling"/>
0153             </xsl:call-template>
0154          </xsl:when>
0155          <!-- Case 1d. new floor AND new ceiling: -->
0156          <xsl:otherwise>
0157             <xsl:call-template name="GetTonalMvmtBounds"> <!--recurse-->
0158                <!-- Select all nodes in this context after first node: -->
0159                <xsl:with-param name="neumeNodeList"
0160                   select="$neumeNodeList[position() > 1]"/>
0161                <xsl:with-param name="tonalMvmtAggregate"
0162                   select="$localAggregate"/>
0163                <xsl:with-param name="tonalMvmtFloor"
0164                   select="$trialFloor"/>
0165                <xsl:with-param name="tonalMvmtCeiling"
0166                   select="$trialCeiling"/>
0167             </xsl:call-template>
0168          </xsl:otherwise>
0169          </xsl:choose>
0170       </xsl:when>
0171       <!-- Case 2. No UNK Tonal Movement in the <neume>: -->
0172       <xsl:otherwise>
0173          <xsl:choose>
0174          <!-- Case 2a. no new floor AND no new ceiling: -->
0175          <xsl:when test="(($trialFloor + $tonalMvmtAggregate) >= $tonalMvmtFloor) and
0176             ($tonalMvmtCeiling >= ($trialCeiling + $tonalMvmtAggregate))">
0177             <xsl:call-template name="GetTonalMvmtBounds"> <!--recurse-->
0178                <!-- Select all nodes in this context after first node: -->
0179                <xsl:with-param name="neumeNodeList"
0180                   select="$neumeNodeList[position() > 1]"/>
0181                <xsl:with-param name="tonalMvmtAggregate"
0182                   select="$tonalMvmtAggregate"/>
0183                <xsl:with-param name="tonalMvmtFloor"
0184                   select="$tonalMvmtFloor"/>
0185                <xsl:with-param name="tonalMvmtCeiling"
0186                   select="$tonalMvmtCeiling"/>
0187             </xsl:call-template>
0188          </xsl:when>
0189          <!-- Case 2b. new floor AND no new ceiling: -->
0190          <xsl:when test="($tonalMvmtFloor > ($trialFloor + $tonalMvmtAggregate)) and
0191             ($tonalMvmtCeiling >= ($trialCeiling + $tonalMvmtAggregate))">
0192             <xsl:call-template name="GetTonalMvmtBounds"> <!--recurse-->
0193                <!-- Select all nodes in this context after first node: -->
0194                <xsl:with-param name="neumeNodeList"
0195                   select="$neumeNodeList[position() > 1]"/>
0196                <xsl:with-param name="tonalMvmtAggregate"
0197                   select="$localAggregate"/>
0198                <xsl:with-param name="tonalMvmtFloor"
0199                   select="($trialFloor + $tonalMvmtAggregate)"/>
0200                <xsl:with-param name="tonalMvmtCeiling"
0201                   select="$tonalMvmtCeiling"/>
0202             </xsl:call-template>
0203          </xsl:when>
0204          <!-- Case 2c. no new floor AND new ceiling: -->
0205          <xsl:when test="(($trialFloor + $tonalMvmtAggregate) >= $tonalMvmtFloor) and
0206             (($trialCeiling + $tonalMvmtAggregate) > $tonalMvmtCeiling)">
0207             <xsl:call-template name="GetTonalMvmtBounds"> <!--recurse-->
0208                <!-- Select all nodes in this context after first node: -->
0209                <xsl:with-param name="neumeNodeList"
0210                   select="$neumeNodeList[position() > 1]"/>
0211                <xsl:with-param name="tonalMvmtAggregate"
0212                   select="$localAggregate"/>
0213                <xsl:with-param name="tonalMvmtFloor"
0214                   select="$tonalMvmtFloor"/>
0215                <xsl:with-param name="tonalMvmtCeiling"
0216                   select="($trialCeiling + $tonalMvmtAggregate)"/>
0217             </xsl:call-template>
0218          </xsl:when>
0219          <!-- Case 2d. new floor AND new ceiling: -->
0220          <xsl:otherwise>
0221             <xsl:call-template name="GetTonalMvmtBounds"> <!--recurse-->
0222                <!-- Select all nodes in this context after first node: -->
0223                <xsl:with-param name="neumeNodeList"
0224                   select="$neumeNodeList[position() > 1]"/>
0225                <xsl:with-param name="tonalMvmtAggregate"
0226                   select="$localAggregate"/>
0227                <xsl:with-param name="tonalMvmtFloor"
0228                   select="($trialFloor + $tonalMvmtAggregate)"/>
0229                <xsl:with-param name="tonalMvmtCeiling"
0230                   select="($trialCeiling + $tonalMvmtAggregate)"/>
0231             </xsl:call-template>
0232          </xsl:otherwise>
0233          </xsl:choose>
0234       </xsl:otherwise>
0235       </xsl:choose>
0236    </xsl:when>
0237    <xsl:otherwise> <!--Stop recursion-->
0238       <!-- Generate a comma-delimited, multi-valued string: -->
0239       <xsl:value-of select="concat($tonalMvmtFloor, ',', $tonalMvmtCeiling)"/>
0240    </xsl:otherwise>
0241    </xsl:choose>
0242 </xsl:template>
0243 <!--[end, GetTonalMvmtBounds]-->
0244 
0245 
0246 <!--   *************************
0247    **  AGGREGATE HEIGHTS  **
0248 
0249 Recursive template parses character-by-character the entire NEUMES subsequence of one
0250 <neume>. Computes the aggregate Tonal Movement, the lowest Tonal Movement, and the
0251 highest Tonal Movement in this <neume>. *resetFlag* is set to 888 if there was
0252 an UNK character in the sequence.
0253 -->
0254 <xsl:template name="AggregateHeights">
0255    <xsl:param name="sequenceToParse" select="text()"/> <!--default value-->
0256    <xsl:param name="localMvmtAggregate" select="0"/> <!--default value-->
0257    <xsl:param name="localMvmtFloor" select="0"/> <!--default value-->
0258    <xsl:param name="localMvmtCeiling" select="0"/> <!--default value-->
0259    <xsl:param name="resetFlag" select="''"/> <!--default value-->
0260 
0261    <xsl:variable name="ThisChar" select="substring($sequenceToParse, 1, 1)"/>
0262 
0263    <xsl:choose>
0264    <!-- Base Case: -->
0265    <xsl:when test="$ThisChar = ''"> <!--Stop recursion at end-of-string-->
0266       <!-- Generate a comma-delimited, multi-valued string: -->
0267       <xsl:value-of select="concat($localMvmtAggregate, ',', $localMvmtFloor, ',',
0268          $localMvmtCeiling, ',', $resetFlag)"/>
0269    </xsl:when>
0270    <!-- Recursive Step: -->
0271    <!-- If this isn't a Movement character, then recurse with shortened line: -->
0272    <xsl:when test="not(contains('&TonalMovements;', $ThisChar))">
0273       <xsl:call-template name="AggregateHeights">
0274          <xsl:with-param name="sequenceToParse"
0275             select="substring($sequenceToParse, 2)"/>
0276          <xsl:with-param name="localMvmtAggregate" select="$localMvmtAggregate"/>
0277          <xsl:with-param name="localMvmtFloor" select="$localMvmtFloor"/>
0278          <xsl:with-param name="localMvmtCeiling" select="$localMvmtCeiling"/>
0279          <xsl:with-param name="resetFlag" select="$resetFlag"/>
0280       </xsl:call-template>
0281    </xsl:when>
0282    <xsl:otherwise>
0283       <!-- Get Movement if this is a Movement character, else 999: -->
0284       <xsl:variable name="Movement">
0285          <xsl:call-template name="LookupMovement">
0286             <xsl:with-param name="ThisChar" select="$ThisChar"/>
0287          </xsl:call-template>
0288       </xsl:variable>
0289       <!-- Handle cases: -->
0290       <xsl:choose>
0291       <!-- If not a movement char [should never happen]; recurse w/shortened line: -->
0292       <xsl:when test="$Movement = 999">
0293          <xsl:call-template name="AggregateHeights">
0294             <xsl:with-param name="sequenceToParse"
0295                select="substring($sequenceToParse, 2)"/>
0296             <xsl:with-param name="localMvmtAggregate"
0297                select="$localMvmtAggregate"/>
0298             <xsl:with-param name="localMvmtFloor" select="$localMvmtFloor"/>
0299             <xsl:with-param name="localMvmtCeiling" select="$localMvmtCeiling"/>
0300             <xsl:with-param name="resetFlag" select="$resetFlag"/>
0301          </xsl:call-template>
0302       </xsl:when>
0303       <xsl:when test="$Movement = 888"> <!--char is UNK Tonal Movement-->
0304          <xsl:call-template name="AggregateHeights">
0305             <xsl:with-param name="sequenceToParse"
0306                select="substring($sequenceToParse, 2)"/>
0307             <!-- Reset aggregate to 0: -->
0308             <xsl:with-param name="localMvmtAggregate" select="0"/>
0309             <xsl:with-param name="localMvmtFloor" select="$localMvmtFloor"/>
0310             <xsl:with-param name="localMvmtCeiling" select="$localMvmtCeiling"/>
0311             <xsl:with-param name="resetFlag" select="888"/> <!--set flag-->
0312          </xsl:call-template>
0313       </xsl:when>
0314       <xsl:otherwise>
0315          <xsl:choose>
0316          <!-- Movement is at a new low: -->
0317          <xsl:when test="$localMvmtFloor > ($localMvmtAggregate + $Movement)">
0318             <xsl:call-template name="AggregateHeights">
0319                <xsl:with-param name="sequenceToParse"
0320                   select="substring($sequenceToParse, 2)"/>
0321                <xsl:with-param name="localMvmtAggregate"
0322                   select="$localMvmtAggregate + $Movement"/>
0323                <xsl:with-param name="localMvmtFloor"
0324                   select="$localMvmtAggregate + $Movement"/>
0325                <xsl:with-param name="localMvmtCeiling"
0326                   select="$localMvmtCeiling"/>
0327                <xsl:with-param name="resetFlag" select="$resetFlag"/><!--N/C-->
0328             </xsl:call-template>
0329          </xsl:when>
0330          <!-- Movement is at a new high: -->
0331          <xsl:when test="($localMvmtAggregate + $Movement) > $localMvmtCeiling">
0332             <xsl:call-template name="AggregateHeights">
0333                <xsl:with-param name="sequenceToParse"
0334                   select="substring($sequenceToParse, 2)"/>
0335                <xsl:with-param name="localMvmtAggregate"
0336                   select="$localMvmtAggregate + $Movement"/>
0337                <xsl:with-param name="localMvmtFloor"
0338                   select="$localMvmtFloor"/>
0339                <xsl:with-param name="localMvmtCeiling"
0340                   select="$localMvmtAggregate + $Movement"/>
0341                <xsl:with-param name="resetFlag" select="$resetFlag"/><!--N/C-->
0342             </xsl:call-template>
0343          </xsl:when>
0344          <!-- No Change to *localMvmtFloor* and *localMvmtCeiling*: -->
0345          <xsl:otherwise>
0346             <xsl:call-template name="AggregateHeights">
0347                <xsl:with-param name="sequenceToParse"
0348                   select="substring($sequenceToParse, 2)"/>
0349                <xsl:with-param name="localMvmtAggregate"
0350                   select="$localMvmtAggregate + $Movement"/>
0351                <xsl:with-param name="localMvmtFloor" select="$localMvmtFloor"/>
0352                <xsl:with-param name="localMvmtCeiling"
0353                   select="$localMvmtCeiling"/>
0354                <xsl:with-param name="resetFlag" select="$resetFlag"/><!--N/C-->
0355             </xsl:call-template>
0356          </xsl:otherwise>
0357          </xsl:choose>
0358       </xsl:otherwise>
0359       </xsl:choose>
0360    </xsl:otherwise>
0361    </xsl:choose>
0362 </xsl:template>
0363 <!--[end, Aggregate Heights]-->
0364 
0365 
0366 <!--   ***********************
0367    **  LOOKUP MOVEMENT  **
0368 
0369 Template maps Tonal Movement character to a number.
0370 -->
0371 <xsl:template name="LookupMovement">
0372    <xsl:param name="ThisChar"/>
0373 
0374    <xsl:choose>
0375    <!-- No Movement: -->
0376    <!-- No preceding tone (beginning of notation): -->
0377    <xsl:when test="$ThisChar='&no_preced;'">0</xsl:when>
0378    <!-- Interval from previous tone is UNKNOWN, return flag: -->
0379    <xsl:when test="$ThisChar='&UNK;'">888</xsl:when>
0380    <!-- Unison (tone equal to preceding) -->
0381    <xsl:when test="$ThisChar='&EQ;'">0</xsl:when>
0382    <!-- Up: -->
0383    <xsl:when test="$ThisChar='&up;'">1</xsl:when>
0384    <xsl:when test="$ThisChar='&up_little;'">1</xsl:when>
0385    <xsl:when test="$ThisChar='&up_lot;'">3</xsl:when>
0386    <xsl:when test="$ThisChar='&up_undiff2;'">2</xsl:when>
0387    <xsl:when test="$ThisChar='&up_m2;'">2</xsl:when>
0388    <xsl:when test="$ThisChar='&up_M2;'">2</xsl:when>
0389    <xsl:when test="$ThisChar='&up_undiff3;'">3</xsl:when>
0390    <xsl:when test="$ThisChar='&up_m3;'">3</xsl:when>
0391    <xsl:when test="$ThisChar='&up_M3;'">3</xsl:when>
0392    <xsl:when test="$ThisChar='&up_4;'">4</xsl:when>
0393    <xsl:when test="$ThisChar='&up_aug4;'">4</xsl:when>
0394    <xsl:when test="$ThisChar='&up_dim5;'">5</xsl:when>
0395    <xsl:when test="$ThisChar='&up_5;'">5</xsl:when>
0396    <xsl:when test="$ThisChar='&up_undiff6;'">6</xsl:when>
0397    <xsl:when test="$ThisChar='&up_m6;'">6</xsl:when>
0398    <xsl:when test="$ThisChar='&up_M6;'">6</xsl:when>
0399    <xsl:when test="$ThisChar='&up_undiff7;'">7</xsl:when>
0400    <xsl:when test="$ThisChar='&up_m7;'">7</xsl:when>
0401    <xsl:when test="$ThisChar='&up_M7;'">7</xsl:when>
0402    <xsl:when test="$ThisChar='&up_8;'">8</xsl:when>
0403    <xsl:when test="$ThisChar='&up_undiff9;'">9</xsl:when>
0404    <!-- Down: -->
0405    <xsl:when test="$ThisChar='&dn;'">-1</xsl:when>
0406    <xsl:when test="$ThisChar='&dn_little;'">-1</xsl:when>
0407    <xsl:when test="$ThisChar='&dn_lot;'">-3</xsl:when>
0408    <xsl:when test="$ThisChar='&dn_undiff2;'">-2</xsl:when>
0409    <xsl:when test="$ThisChar='&dn_m2;'">-2</xsl:when>
0410    <xsl:when test="$ThisChar='&dn_M2;'">-2</xsl:when>
0411    <xsl:when test="$ThisChar='&dn_undiff3;'">-3</xsl:when>
0412    <xsl:when test="$ThisChar='&dn_m3;'">-3</xsl:when>
0413    <xsl:when test="$ThisChar='&dn_M3;'">-3</xsl:when>
0414    <xsl:when test="$ThisChar='&dn_4;'">-4</xsl:when>
0415    <xsl:when test="$ThisChar='&dn_aug4;'">-4</xsl:when>
0416    <xsl:when test="$ThisChar='&dn_dim5;'">-5</xsl:when>
0417    <xsl:when test="$ThisChar='&dn_5;'">-5</xsl:when>
0418    <xsl:when test="$ThisChar='&dn_undiff6;'">-6</xsl:when>
0419    <xsl:when test="$ThisChar='&dn_m6;'">-6</xsl:when>
0420    <xsl:when test="$ThisChar='&dn_M6;'">-6</xsl:when>
0421    <xsl:when test="$ThisChar='&dn_undiff7;'">-7</xsl:when>
0422    <xsl:when test="$ThisChar='&dn_m7;'">-7</xsl:when>
0423    <xsl:when test="$ThisChar='&dn_M7;'">-7</xsl:when>
0424    <xsl:when test="$ThisChar='&dn_8;'">-8</xsl:when>
0425    <xsl:when test="$ThisChar='&dn_undiff9;'">-9</xsl:when>
0426    <!-- All Others [should never happen], set skip flag: -->
0427    <xsl:otherwise>999</xsl:otherwise>
0428    </xsl:choose>
0429 </xsl:template>
0430 <!--[end, LookupMovement]-->
0431 
0432 
0433 <!--   ***********************
0434    **  MAP GLYPH IMAGE  **
0435 
0436 Template maps from NEUMES char of Neumatic glyphs to a .gif filename;</span>
0437 generates the filename. *SubStyle* can be a Substitute Style or a Qualifier.
0438 [Template may be expanded to get image dimensions from "manifest" file, and
0439 generate a multi-value string.]
0440 -->
0441 <xsl:template name="MapGlyphImage">
0442    <xsl:param name="CharToShow"/>
0443    <xsl:param name="SubStyle"/> <!--Substitute Style-->
0444 
0445    <xsl:choose>
0446    <!--   *** CLEF SIGNS (WESTERN): *** -->
0447    <xsl:when test="$CharToShow='&doh_clef;'">doh_clef_1.gif</xsl:when>
0448    <xsl:when test="$CharToShow='&fah_clef;'">fah_clef_1.gif</xsl:when>
0449 
0450    <!--   *** SPECIAL CHARS (WESTERN): *** -->
0451    <xsl:when test="$CharToShow='&custos;'">custos_1.gif</xsl:when>
0452    <xsl:when test="$CharToShow='&ut_supra;'">ut_supra_1.gif</xsl:when>
0453 
0454    <!--   *** WESTERN GLYPHS: *** -->
0455    <xsl:when test="$CharToShow='&apostropha;'">apostropha_1.gif</xsl:when>
0456    <xsl:when test="$CharToShow='&oriscus_det;'">
0457       <xsl:choose>
0458       <xsl:when test="$SubStyle='&subst6;'">oriscus_6.gif</xsl:when>
0459       <xsl:when test="$SubStyle='&subst5;'">oriscus_5.gif</xsl:when>
0460       <xsl:otherwise>oriscus_1.gif</xsl:otherwise>
0461       </xsl:choose>
0462    </xsl:when>
0463    <xsl:when test="$CharToShow='&punctum;'">
0464       <xsl:choose>
0465       <xsl:when test="$SubStyle='&subst5;'">punctum_5.gif</xsl:when>
0466       <xsl:when test="$SubStyle='&subst4;'">punctum_4.gif</xsl:when>
0467       <xsl:when test="$SubStyle='&subst3;'">punctum_3.gif</xsl:when>
0468       <xsl:when test="$SubStyle='&subst2;'">punctum_2.gif</xsl:when>
0469       <xsl:otherwise>punctum_1.gif</xsl:otherwise>
0470       </xsl:choose>
0471    </xsl:when>
0472    <xsl:when test="$CharToShow='&tractulus;'">
0473       <xsl:choose>
0474       <xsl:when test="$SubStyle='&subst2;'">tractulus_2.gif</xsl:when>
0475       <xsl:otherwise>tractulus_1.gif</xsl:otherwise>
0476       </xsl:choose>
0477    </xsl:when>
0478    <xsl:when test="$CharToShow='&virga;'">
0479       <xsl:choose>
0480       <xsl:when test="$SubStyle='&quilisma;'">quilisma_1.gif</xsl:when>
0481       <xsl:when test="$SubStyle='&subst2;'">virga_2.gif</xsl:when>
0482       <xsl:otherwise>virga_1.gif</xsl:otherwise>
0483       </xsl:choose>
0484    </xsl:when>
0485    <xsl:when test="$CharToShow='&clivis;'">
0486       <xsl:choose>
0487       <xsl:when test="$SubStyle='&subst5;'">clivis_5.gif</xsl:when>
0488       <xsl:when test="$SubStyle='&subst4;'">clivis_4.gif</xsl:when>
0489       <xsl:when test="$SubStyle='&subst3;'">clivis_3.gif</xsl:when>
0490       <xsl:when test="$SubStyle='&subst2;'">clivis_2.gif</xsl:when>
0491       <xsl:otherwise>clivis_1.gif</xsl:otherwise>
0492       </xsl:choose>
0493    </xsl:when>
0494    <xsl:when test="$CharToShow='&pes;'">
0495       <xsl:choose>
0496       <xsl:when test="$SubStyle='&subst4;'">pes_4.gif</xsl:when>
0497       <xsl:when test="$SubStyle='&subst3;'">pes_3.gif</xsl:when>
0498       <xsl:when test="$SubStyle='&subst2;'">pes_2.gif</xsl:when>
0499       <xsl:otherwise>pes_1.gif</xsl:otherwise>
0500       </xsl:choose>
0501    </xsl:when>
0502    <xsl:when test="$CharToShow='&porrectus;'">
0503       <xsl:choose>
0504       <xsl:when test="$SubStyle='&subst5;'">porrectus_5.gif</xsl:when>
0505       <xsl:when test="$SubStyle='&subst4;'">porrectus_4.gif</xsl:when>
0506       <xsl:when test="$SubStyle='&subst3;'">porrectus_3.gif</xsl:when>
0507       <xsl:when test="$SubStyle='&subst2;'">porrectus_2.gif</xsl:when>
0508       <xsl:otherwise>porrectus_1.gif</xsl:otherwise>
0509       </xsl:choose>
0510    </xsl:when>
0511    <xsl:when test="$CharToShow='&torculus;'">
0512       <xsl:choose>
0513       <xsl:when test="$SubStyle='&subst4;'">torculus_4.gif</xsl:when>
0514       <xsl:otherwise>torculus_1.gif</xsl:otherwise>
0515       </xsl:choose>
0516    </xsl:when>
0517    <xsl:when test="$CharToShow='&trigon;'">trigon_1.gif</xsl:when>
0518    <xsl:when test="$CharToShow='&torculus_resupinus;'">torculus_resupinus_1.gif</xsl:when>
0519    <xsl:when test="$CharToShow='&pes_quassus;'">pes_quassus_1.gif</xsl:when>
0520    <xsl:when test="$CharToShow='&virga_strata;'">virga_strata_1.gif</xsl:when>
0521    <xsl:when test="$CharToShow='&pressus_maior;'">pressus_maior_1.gif</xsl:when>
0522    <!-- COMPATIBILITY CHARACTERS (WESTERN): -->
0523    <xsl:when test="$CharToShow='&tristropha;'">tristropha_1.gif</xsl:when>
0524    <xsl:when test="$CharToShow='&climacus3;'">
0525       <xsl:choose>
0526       <xsl:when test="$SubStyle='&subst3;'">climacus3_3.gif</xsl:when>
0527       <xsl:when test="$SubStyle='&subst2;'">climacus3_2.gif</xsl:when>
0528       <xsl:otherwise>climacus3_1.gif</xsl:otherwise>
0529       </xsl:choose>
0530    </xsl:when>
0531    <xsl:when test="$CharToShow='&climacus4;'">
0532       <xsl:choose>
0533       <xsl:when test="$SubStyle='&subst2;'">climacus4_2.gif</xsl:when>
0534       <xsl:otherwise>climacus4_1.gif</xsl:otherwise>
0535       </xsl:choose>
0536    </xsl:when>
0537    <xsl:when test="$CharToShow='&climacus5;'">
0538       <xsl:choose>
0539       <xsl:when test="$SubStyle='&subst2;'">climacus5_2.gif</xsl:when>
0540       <xsl:otherwise>climacus5_1.gif</xsl:otherwise>
0541       </xsl:choose>
0542    </xsl:when>
0543    <xsl:when test="$CharToShow='&scandicus3;'">scandicus3_1.gif</xsl:when>
0544    <xsl:when test="$CharToShow='&scandicus4;'">scandicus4_1.gif</xsl:when>
0545    <xsl:when test="$CharToShow='&scandicus_flexus4;'">scandicus_flexus4_1.gif</xsl:when>
0546    <xsl:when test="$CharToShow='&pes_subpunctis4;'">pes_subpunctis4_1.gif</xsl:when>
0547    <xsl:when test="$CharToShow='&pes_subpunctis5;'">pes_subpunctis5_1.gif</xsl:when>
0548    <!-- DO NOT break line: -->
0549    <xsl:when test="$CharToShow='&torculus_resupinus_subpunctis;'">torculus_resupinus_subpunctis_1.gif</xsl:when>
0550 
0551 
0552    <!--   *** MARTYRIAI (BYZANTINE): *** -->
0553    <xsl:when test="$CharToShow='&barys;'">barys_1.gif</xsl:when>
0554    <xsl:when test="$CharToShow='&deuteros;'">
0555       <xsl:choose>
0556       <xsl:when test="$SubStyle='&subst2;'">deuteros_2.gif</xsl:when>
0557       <xsl:otherwise>deuteros_1.gif</xsl:otherwise>
0558       </xsl:choose>
0559    </xsl:when>
0560    <xsl:when test="$CharToShow='&echos;'">echos_1.gif</xsl:when>
0561    <xsl:when test="$CharToShow='&mesos;'">mesos_1.gif</xsl:when>
0562    <xsl:when test="$CharToShow='&na;'">
0563       <xsl:choose>
0564       <xsl:when test="$SubStyle='&subst2;'">na_2.gif</xsl:when>
0565       <xsl:otherwise>na_1.gif</xsl:otherwise>
0566       </xsl:choose>
0567    </xsl:when>
0568    <xsl:when test="$CharToShow='&nana;'">
0569       <xsl:choose>
0570       <xsl:when test="$SubStyle='&subst3;'">nana_3.gif</xsl:when>
0571       <xsl:when test="$SubStyle='&subst2;'">nana_2.gif</xsl:when>
0572       <xsl:otherwise>nana_1.gif</xsl:otherwise>
0573       </xsl:choose>
0574    </xsl:when>
0575    <xsl:when test="$CharToShow='&ne;'">ne_1.gif</xsl:when>
0576    <xsl:when test="$CharToShow='&plagios;'">plagios_1.gif</xsl:when>
0577    <xsl:when test="$CharToShow='&protos;'">protos_1.gif</xsl:when>
0578    <xsl:when test="$CharToShow='&sigma_mar;'">sigma_1.gif</xsl:when>
0579    <xsl:when test="$CharToShow='&tetartos;'">tetartos_1.gif</xsl:when>
0580    <xsl:when test="$CharToShow='&tritos;'">tritos_1.gif</xsl:when>
0581    <xsl:when
0582    test="$CharToShow='&fanerosis_tetrafonias;'">fanerosis_tetrafonias_1.gif</xsl:when>
0583    <!-- Pre-composed Martyriai: -->
0584    <xsl:when test="$CharToShow='&martyria_deuteros;'">
0585       <xsl:choose>
0586       <xsl:when test="$SubStyle='&subst3;'">martyria_deuteros_3.gif</xsl:when>
0587       <xsl:when test="$SubStyle='&subst2;'">martyria_deuteros_2.gif</xsl:when>
0588       <xsl:otherwise>martyria_deuteros_1.gif</xsl:otherwise>
0589       </xsl:choose>
0590    </xsl:when>
0591    <xsl:when test="$CharToShow='&martyria_plagios_deuteros;'">
0592       <xsl:choose>
0593       <xsl:when test="$SubStyle='&subst2;'">martyria_plagios_deuteros_2.gif</xsl:when>
0594       <xsl:otherwise>martyria_plagios_deuteros_1.gif</xsl:otherwise>
0595       </xsl:choose>
0596    </xsl:when>
0597 
0598 
0599    <!--   NEUMATIC GLYPHS (BYZANTINE): *** -->
0600    <!-- Characters of Voice or Quantity: -->
0601    <xsl:when test="$CharToShow='&ison;'">ison_1.gif</xsl:when>
0602    <xsl:when test="$CharToShow='&oligon;'">oligon_1.gif</xsl:when>
0603    <xsl:when test="$CharToShow='&oxeia;'">oxeia_1.gif</xsl:when>
0604    <xsl:when test="$CharToShow='&petaste;'">petaste_1.gif</xsl:when>
0605    <xsl:when test="$CharToShow='&dyo-kentemata;'">dyo-kentemata_1.gif</xsl:when>
0606    <xsl:when test="$CharToShow='&kentemata;'">dyo-kentemata_1.gif</xsl:when>
0607    <xsl:when test="$CharToShow='&kouphisma;'">kouphisma_1.gif</xsl:when>
0608 <!--
0609    <xsl:when test="$CharToShow='<span class="SymbolColor">&pelaston;</span>'">pelaston_1.gif</xsl:when>
0610 -->
0611    <xsl:when test="$CharToShow='&kentema;'">kentema_1.gif</xsl:when>
0612    <xsl:when test="$CharToShow='&hypsele;'">hypsele_1.gif</xsl:when>
0613    <xsl:when test="$CharToShow='&apostrophos;'">apostrophos_1.gif</xsl:when>
0614    <xsl:when test="$CharToShow='&dyo-apostrophoi;'">dyo-apostrophoi_1.gif</xsl:when>
0615 <!--
0616    <xsl:when test="$CharToShow='<span class="SymbolColor">&hyporrhoe;</span>'">hyporrhoe_1.gif</xsl:when>
0617 -->
0618    <xsl:when test="$CharToShow='&elaphron;'">elaphron_1.gif</xsl:when>
0619    <xsl:when test="$CharToShow='&chamele;'">chamele_1.gif</xsl:when>
0620 
0621    <!--   GLYPH QUALIFIER GLYPHS (BYZANTINE)
0622    Qualifier glyphs concerned with rhythmic features or tempo -->
0623    <xsl:when test="$CharToShow='&diple;'">diple_1.gif</xsl:when>
0624    <xsl:when test="$CharToShow='&kratema;'">kratema_1.gif</xsl:when>
0625    <xsl:when test="$CharToShow='&klasma;'">klasma_1.gif</xsl:when>
0626    <xsl:when test="$CharToShow='&xeron-klasma;'">xeron-klasma_1.gif</xsl:when>
0627    <xsl:when test="$CharToShow='&apoderma;'">apoderma_1.gif</xsl:when>
0628    <xsl:when test="$CharToShow='&gorgon;'">gorgon_1.gif</xsl:when>
0629    <xsl:when test="$CharToShow='&mikron_ison;'">mikron_ison_1.gif</xsl:when>
0630    <xsl:when test="$CharToShow='&antikenoma;'">antikenoma_1.gif</xsl:when>
0631 
0632    <!-- GREAT SIGNS (BYZANTINE):
0633    Megala Semadia, -->
0634    <xsl:when test="$CharToShow='&bareia;'">bareia_1.gif</xsl:when>
0635    <xsl:when test="$CharToShow='&psephiston;'">psephiston_1.gif</xsl:when>
0636    <xsl:when test="$CharToShow='&kylisma;'">kylisma_1.gif</xsl:when>
0637    <xsl:when test="$CharToShow='&antikenoma;'">antikenoma_1.gif</xsl:when>
0638 
0639    <!-- COMPATIBILITY CHARACTERS (BYZANTINE):
0640    Combinations of signs with specific intervallic values (not_ covered by Unicode 3.1
0641    Byzantine)
0642    -->
0643    <xsl:when test="$CharToShow='&ison_over_petaste;'">ison_over_petaste_1.gif</xsl:when>
0644    <xsl:when test="$CharToShow='&oligon_over_petaste;'">oligon_over_petaste_1.gif</xsl:when>
0645    <xsl:when test="$CharToShow='&oligon_and_kentema;'">oligon_and_kentema_1.gif</xsl:when>
0646    <xsl:when test="$CharToShow='&oxeia_and_kentema;'">oxeia_and_kentema_1.gif</xsl:when>
0647    <xsl:when test="$CharToShow='&kentema_over_oligon;'">kentema_over_oligon_1.gif</xsl:when>
0648    <xsl:when test="$CharToShow='&kentema_over_petaste;'">kentema_over_petaste_1.gif</xsl:when>
0649    <xsl:when test="$CharToShow='&kentema-over-oxeia_and_hypsele;'">kentema-over-oxeia_and_hypsele_1.gif</xsl:when>
0650    <xsl:when
0651       test="$CharToShow='&apostrophos_and_elaphron;'">apostrophos_and_elaphron_1.gif</xsl:when>
0652    <xsl:when
0653       test="$CharToShow='&elaphron_over_apostrophos;'">elaphron_over_apostrophos_1.gif</xsl:when>
0654    <xsl:when
0655       test="$CharToShow='&apostrophos_and_chamele;'">apostrophos_and_chamele_1.gif</xsl:when>
0656    <xsl:when
0657       test="$CharToShow='&apostrophos_and_mikron_ison;'">apostrophos_and_mikron_ison_1.gif</xsl:when>
0658    <xsl:when
0659       test="$CharToShow='&apostrophos_and_isaki;'">apostrophos_and_isaki_1.gif</xsl:when>
0660    <xsl:when
0661       test="$CharToShow='&mikron_ison_and_ison;'">mikron_ison_and_ison_1.gif</xsl:when>
0662    <xsl:when
0663       test="$CharToShow='&mikron_ison_and_oxeia;'">mikron_ison_and_oxeia_1.gif</xsl:when>
0664    <xsl:when
0665       test="$CharToShow='&mikron_ison_and_oligon;'">mikron_ison_and_oligon_1.gif</xsl:when>
0666 
0667    <!-- Generate Object Replacement Character (unspecified placeholder): -->
0668    <xsl:otherwise>&objReplace;</xsl:otherwise>
0669    </xsl:choose>
0670 </xsl:template>
0671 <!--[end, Map Glyph Image]-->
0672 
0673 
0674 <!--   **********************
0675    **  COMPUTE HEIGHT  **
0676 
0677 Recursive template parses character-by-character the NEUMES subsequence of
0678 one glyph. Recursion stops at first END char of the given sequence.
0679 Each tone in a multi-tone glyph has a separate tonal movement specifier.
0680 Generates a comma-delimited string containing the *leadingMvmt* (tonal movement
0681 from the previous glyph, in tones) and the *internalMvmt* (sum of internal
0682 movement in case of a multi-tone glyph). *leadingMvmt* of 888 means initial
0683 tone of glyph is [UNK].
0684 -->
0685 <xsl:template name="ComputeHeight">
0686    <xsl:param name="sequenceToParse"/>
0687    <xsl:param name="leadingMvmt" select="999"/> <!--default value-->
0688    <xsl:param name="internalMvmt" select="0"/> <!--default value-->
0689 
0690    <xsl:variable name="ThisChar" select="substring($sequenceToParse, 1, 1)"/> 
0691 
0692    <xsl:choose>
0693    <!-- Base Case: -->
0694    <!-- Stop recursion at end-of-string [should never happen] or at END: -->
0695    <xsl:when test="$ThisChar = '' or $ThisChar = '&END;'">
0696       <!-- Return the leading movement and internal movement; stop recursing: -->
0697       <xsl:value-of select="concat($leadingMvmt, ',', $internalMvmt)"/>
0698    </xsl:when>
0699    <!-- Recursive Step: -->
0700    <!-- If this isn't a movement character, then recurse with shortened line: -->
0701    <xsl:when test="not(contains('&TonalMovements;', $ThisChar))">
0702       <xsl:call-template name="ComputeHeight">
0703          <xsl:with-param name="sequenceToParse"
0704             select="substring($sequenceToParse, 2)"/>
0705          <xsl:with-param name="leadingMvmt" select="$leadingMvmt"/>
0706          <xsl:with-param name="internalMvmt" select="$internalMvmt"/>
0707       </xsl:call-template>
0708    </xsl:when>
0709    <xsl:otherwise>
0710       <!-- Get movement if this is a movement character, else 999: -->
0711       <xsl:variable name="Movement">
0712          <xsl:call-template name="LookupMovement">
0713             <xsl:with-param name="ThisChar" select="$ThisChar"/>
0714          </xsl:call-template>
0715       </xsl:variable>
0716       <xsl:choose>
0717       <!-- If not a movement char [should never happen]; recurse w/shortened line: -->
0718       <xsl:when test="$Movement=999">
0719          <xsl:call-template name="ComputeHeight">
0720             <xsl:with-param name="sequenceToParse"
0721                select="substring($sequenceToParse, 2)"/>
0722             <xsl:with-param name="leadingMvmt" select="$leadingMvmt"/>
0723             <xsl:with-param name="internalMvmt" select="$internalMvmt"/>
0724          </xsl:call-template>
0725       </xsl:when>
0726       <!-- If UNK movement, pass 888 flag for leadingMvmt, or use 0: -->
0727       <xsl:when test="$Movement=888">
0728          <xsl:choose>
0729          <!-- leadingMvmt has not been set yet: -->
0730          <xsl:when test="$leadingMvmt=999">
0731             <xsl:call-template name="ComputeHeight">
0732                <xsl:with-param name="sequenceToParse"
0733                   select="substring($sequenceToParse, 2)"/>
0734                <xsl:with-param name="leadingMvmt" select="$Movement"/>
0735                <xsl:with-param name="internalMvmt" select="0"/>
0736             </xsl:call-template>
0737          </xsl:when>
0738          <!-- leadingMvmt has been set: -->
0739          <xsl:otherwise>
0740             <xsl:call-template name="ComputeHeight">
0741                <xsl:with-param name="sequenceToParse"
0742                   select="substring($sequenceToParse, 2)"/>
0743                <xsl:with-param name="leadingMvmt" select="$leadingMvmt"/>
0744                <xsl:with-param name="internalMvmt"
0745                   select="$internalMvmt + 0"/>
0746             </xsl:call-template>
0747          </xsl:otherwise>
0748          </xsl:choose>
0749       </xsl:when>
0750       <!-- This was a movement char w/known movement: -->
0751       <xsl:otherwise>
0752          <xsl:choose>
0753          <!-- leadingMvmt has not been set yet: -->
0754          <xsl:when test="$leadingMvmt=999">
0755             <xsl:call-template name="ComputeHeight">
0756                <xsl:with-param name="sequenceToParse"
0757                   select="substring($sequenceToParse, 2)"/>
0758                <xsl:with-param name="leadingMvmt" select="$Movement"/>
0759                <xsl:with-param name="internalMvmt" select="0"/>
0760             </xsl:call-template>
0761          </xsl:when>
0762          <!-- leadingMvmt has been set: -->
0763          <xsl:otherwise>
0764             <xsl:call-template name="ComputeHeight">
0765                <xsl:with-param name="sequenceToParse"
0766                   select="substring($sequenceToParse, 2)"/>
0767                <xsl:with-param name="leadingMvmt" select="$leadingMvmt"/>
0768                <xsl:with-param name="internalMvmt"
0769                   select="$internalMvmt + $Movement"/>
0770             </xsl:call-template>
0771          </xsl:otherwise>
0772          </xsl:choose>
0773       </xsl:otherwise>
0774       </xsl:choose>
0775    </xsl:otherwise>
0776    </xsl:choose>
0777 </xsl:template>
0778 <!--[end, ComputeHeight]-->
0779 
0780 
0781 <!--   *****************
0782    **  LOOKUP CF  **
0783 
0784 Template maps NEUMES CF char to a value;</span> defaults to 10.
0785 -->
0786 <xsl:template name="LookupCF">
0787    <xsl:param name="CF"/>
0788 
0789    <xsl:choose>
0790    <xsl:when test="$CF='&CF_p10;'">10</xsl:when>
0791    <xsl:when test="$CF='&CF_p09;'">9</xsl:when>
0792    <xsl:when test="$CF='&CF_p08;'">8</xsl:when>
0793    <xsl:when test="$CF='&CF_p07;'">7</xsl:when>
0794    <xsl:when test="$CF='&CF_p06;'">6</xsl:when>
0795    <xsl:when test="$CF='&CF_p05;'">5</xsl:when>
0796    <xsl:when test="$CF='&CF_p04;'">4</xsl:when>
0797    <xsl:when test="$CF='&CF_p03;'">3</xsl:when>
0798    <xsl:when test="$CF='&CF_p02;'">2</xsl:when>
0799    <xsl:when test="$CF='&CF_p01;'">1</xsl:when>
0800    <xsl:when test="$CF='&CF_u00;'">0</xsl:when>
0801    <xsl:when test="$CF='&CF_n01;'">-1</xsl:when>
0802    <xsl:when test="$CF='&CF_n02;'">-2</xsl:when>
0803    <xsl:when test="$CF='&CF_n03;'">-3</xsl:when>
0804    <xsl:when test="$CF='&CF_n04;'">-4</xsl:when>
0805    <xsl:when test="$CF='&CF_n05;'">-5</xsl:when>
0806    <xsl:when test="$CF='&CF_n06;'">-6</xsl:when>
0807    <xsl:when test="$CF='&CF_n07;'">-7</xsl:when>
0808    <xsl:when test="$CF='&CF_n08;'">-8</xsl:when>
0809    <xsl:when test="$CF='&CF_n09;'">-9</xsl:when>
0810    <xsl:when test="$CF='&CF_n10;'">-10</xsl:when>
0811    <xsl:otherwise>10</xsl:otherwise>
0812    </xsl:choose>
0813 </xsl:template>
0814 
0815 
0816 <!--   *********************
0817    **  ESCAPE QUOTES  **
0818 
0819 Escape double-quotes in the passed string;</span> generate the string:
0820 [NOTE: Do not change the nesting of single and double quotes in this Template.]
0821 -->
0822 <xsl:template name="EscQuot">
0823    <xsl:param name="passString"/>
0824 
0825    <xsl:variable name="Quot" select="'&quot;'"/>
0826    <xsl:choose>
0827    <xsl:when test='contains($passString, $Quot)'>
0828       <xsl:value-of select='substring-before($passString, $Quot)'/>
0829       <xsl:text>\</xsl:text><xsl:value-of select="$Quot"/>
0830       <xsl:call-template name="EscQuot">
0831          <xsl:with-param name="passString"
0832             select='substring-after($passString, $Quot)'/>
0833       </xsl:call-template>
0834    </xsl:when>
0835    <xsl:otherwise>
0836       <xsl:value-of select="$passString"/>
0837    </xsl:otherwise>
0838    </xsl:choose>
0839 </xsl:template>
0840 
0841 
0842 <!--   *************************
0843    **  ESCAPE APOSTROPHE  **
0844 
0845 Escape single-quotes in the passed string;</span> generate the string:
0846 [NOTE: Do not change the nesting of single and double quotes in this Template.]
0847 -->
0848 <xsl:template name="EscApos">
0849    <xsl:param name="passString"/>
0850 
0851    <xsl:variable name="Apos" select='"&apos;"'/>
0852    <xsl:choose>
0853    <xsl:when test='contains($passString, $Apos)'>
0854       <xsl:value-of select='substring-before($passString, $Apos)'/>
0855       <xsl:text>\</xsl:text><xsl:value-of select="$Apos"/>
0856       <xsl:call-template name="EscApos">
0857          <xsl:with-param name="passString"
0858             select='substring-after($passString, $Apos)'/>
0859       </xsl:call-template>
0860    </xsl:when>
0861    <xsl:otherwise>
0862       <xsl:value-of select="$passString"/>
0863    </xsl:otherwise>
0864    </xsl:choose>
0865 </xsl:template>
0866 
0867 </xsl:stylesheet> 
0868 
0869 <!-- END, NeumesXSLT_utils.xsl -->
= END LISTING =