<?xml version='1.0' encoding="UTF-8" standalone="no"?>
<!--
*	XML Transformation (XSLT) generated on 6 December 2006.
*	Filename: http://www.scribeserver.com/NEUMES/xml/NeumesXML.xsl
*	Version: 3.1
*	Owner: The NEUMES Project
*	(Neumed and Ecphonetic Universal Manuscript Encoding Standard).
*	For details see, http://purl.oclc.org/SCRIBE/NEUMES/
*	Authors: Louis W. G. Barton, with Clare McInerney and Jeni Tennison.
*	Type: XML XSLT
-->

<!--	NeumesXML visualization XSLT
	Output: HTML 'beta-test' visualization for NeumesXML Schema version 2.3
	Instance documents. This is an XSLT (XML Stylesheet Language Transformations)
	for NeumesXML. NeumesXML is an XML application for describing medieval chant
	manuscript sources and transcribing their content to data in NEUMES format.

	Protected by law under one or more of the following copyrights:
	Copyright 2005-2006, The University of Oxford.
	Copyright 2003-2005, Louis W. G. Barton.
	Copyright 2002-2003, The President and Fellows of Harvard College;
	contains software or other intellectual property licensed from
	Louis W. G. Barton, copyright 1995-2001 by Louis W. G. Barton.

	The copyright holders grant royalty-free license to transmit, display,
	perform and/or distribute without modification the NeumeXML version 2
	Schema and its accompanying documentation for non-commercial
	educational, cultural, and charitable uses, provided that the above
	copyright notice and this paragraph appear in all copies. The copyright
	holders make no representation about the suitability of the Schema and
	its accompanying documentation for any purpose. It is provided "as is"
	without expressed or implied warranty.
-->

<!DOCTYPE xsl:stylesheet SYSTEM "http://www.scribeserver.com/NEUMES/xml/NeumesXML_xsl.dtd" [
<!-- *** NeumesXML_xsl.dtd includes NEUMES codepoint declarations. *** -->
<!-- ****** Visualization Entities Particular to this Transformation: ****** -->
<!ENTITY version_this	"3.1"> <!--version number of this XSLT -->
<!--standard images path:-->
<!ENTITY std_img_path	"http://www.scribeserver.com/NEUMES/xml/images">
<!--standard scripts path:-->
<!ENTITY std_scripts_path	"http://www.scribeserver.com/NEUMES/scripts">
<!--standard XML files path:-->
<!ENTITY std_xml_path	"http://www.scribeserver.com/NEUMES/xml">
<!ENTITY red_subpath	"red/"> <!--subpath expression for red glyphs-->
<!ENTITY file_parm_name	"filepath"> <!-- NOTE: synchronize with NeumesXSLTServlet.java -->
<!ENTITY verdana		"Verdana,Geneva,Arial,Helvetica,sans-serif"> <!--font face-->
<!ENTITY start_neume	"&#091;"> <!--start neume (left square bracket)-->
<!ENTITY start_rubric	"&#091;"> <!--start rubric (left square bracket)-->
<!-- SUB-space enlarges row uniformly for comment or CFs: -->
<!ENTITY end_neume	"&lt;SUB> &lt;/SUB>&#093;"> <!--end neume (right square bracket)-->
<!ENTITY end_rubric	"&lt;SUB> &lt;/SUB>&#093;"> <!--end rubric (right square bracket)-->
<!ENTITY vowel_spacer	"3"> <!--approximate Displacement of vowel from syllable (3px)-->
<!ENTITY cm			"&lt;SUB>*&lt;/SUB>"> <!--hypercomment (hash mark 035)-->
<!ENTITY cf			"&lt;SUP>&#037;&lt;/SUP>"> <!--certainty factor (percent sign)-->
<!ENTITY no_tone_mark	" &nbsp;"> <!--neumatic glyph has no tonal quality-->
<!ENTITY no_preced_tone	" 0"> <!--no preceding tonal movement-->
<!ENTITY mv_unk		" ?"> <!--tonal movement unknown (question mark)-->
<!ENTITY mv_eq		" ="> <!--tonal movement equal (space, equals sign)-->
<!ENTITY mv_up		" +"> <!--tonal movement up (plus sign)-->
<!ENTITY mv_dn		" -"> <!--tonal movement down (space, minus sign)-->
<!ENTITY ligation		"^"> <!--ligated to next tone (circumflex)-->
<!-- Tonal Movement background color: -->
<!ENTITY tonal_bg		"background-color:rgb(255,255,186);">
]>

<!-- Root Element: -->
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:nxm="http://www.scribeserver.com/NEUMES/xml/NeumesXML"
>

<xsl:include href="&std_xml_path;/NeumesXSLT_utils.xsl"/>

<!--[end, Root Element]-->

<xsl:output method="html"/>


<!--	PROGRAMMER'S NOTES:
* Dependencies:
* - Reading of external Glyphs Manifest XML file can be done only after loading
    sarissa.js and sarissa_ieemu_xpath.js. XMLHttpRequest(), DOMParser(), and
    Sarissa.setXpathNamespaces are defined in sarissa.js. Some functionality for
    this of Internet Explorer is emulated for Mozilla by sarissa_ieemu_xpath.js.
* If notation is unheighted, then the 'baseline' numbers are ignored, and all glyphs
  get aligned at the bottom.
* Definition: "Offset" is a metric of the vertical position of a glyph image (or an
  adjunct text particle) in visualization, above or below the global baseline for glyph
  image rendering.
* Definition: "Displacement" is a metric of the horizontal position of a glyph image
  (or a text particle) in visualization, to the right of the preceding glyph or text.
* Rem: Cf, INTONED TEXT Row
* To do: allow suppress of linebreaks.
* To do: change default imgBasePath to dothead.
* To do: divide glyph and qualifier tests by east/west.
* Utilities moved to file NeumesXSLT_utils.xsl.
* Remark: for 'if' tests, JS uses '==' for comparator relation; XSLT uses '='.
* The stylesheet gets validated every time it is run. Most XSLT processors, however,
  do not validate a stylesheet against the DTD given in the DOCTYPE declaration; the
  rules for XSLT are too complicated to be summed up in a DTD.
* Future: if we do a transformation on the NeumesXML Schema, we would need the 'obd'
  namespace to be declared so that we could process the documentation in the schemas;
  in this case, we would also need the 'xsd' namespace declaration since we would be
  processing XSD Elements.
* The <xsl:output> method specifies serialization of the results of this transformation
  as HTML. This transformation is creating HTML Elements in no namespace (because there
  is no default namespace declaration). By rule in XSLT, HTML Elements created in no
  namespace are serialized as HTML.
  One could add the default namespace declaration,
	xmlns="http://www.w3.org/1999/xhtml"
  in which case, the output would be like XML (e.g., you'd get <br/> instead of <br>);
  <xsl:output method="html"/> would then be essential to ensure the output is written
  as HTML. Selective output in XML form can be done by the 'HTML' prefix and the
  declaration,
  	xmlns:HTML="http://www.w3.org/Profiles/XHTML-transitional"
* W3C Visual Formatting Model (Inline Formatting Context): "When several inline boxes
  cannot fit horizontally within a single line box, they are distributed among two or
  more vertically-stacked line boxes. ... When the total width of the inline boxes on
  a line is less than the width of the line box containing them, their horizontal
  distribution within the line box is determined by the 'text-align' property."
* Table layout for visualization
	Row 1: neumatic symbols
	Row 2: chant text
	Row 3: pitches
	Row 4: tonal movement
* DO NOT break a line of JavaScript, except a literal followed by '+'.

Strategy:
BOGUS - revise (up from bottom of containing box to bottom of IMG]
1/ Tonal movement (leadingMvmt and internalMvmt) is calculated up/down in
*steps* (or, 'tones'). Example: currently, dn_m3 and dn_M3 both evaluate to
tonal movement of "-3".
2/ Utilities Template 'GetTonalMvmtBounds' calculates the tonal range of the
whole chant above/below the intial glyph.
3/ transcriptionBaseline is in pixels (positive) up from bottom of glyphs Row.
4/ The first glyph in a transcription is at the transcriptionBaseline, and
gets positioned as (-glyphRowHeight + transcriptionBaseline) down from top.
5/ In Image layout, JS fn drawGlyph() uses position-relative, with top equal
to the number of pixels down from top of containing box to top of Image.
6/ In staffed notation, staff is displayed as a background image, and
vertical position is measured up from bottom of containing box.
7/ During display of glyphs, the tonal movement just be scaled by multiplying
it by the heightingFactor to produce the pixels down from top of containing box.

[End, Programmer's Notes]-->


<!--	XSLT GLOBAL VARIABLES: -->
<xsl:variable name="discipline" select="//nxm:encoding_declaration/@discipline"/>
<xsl:variable name="notation_family" select="//nxm:notation_x/@family"/>
<!-- Temp conditional: -->
<xsl:variable name="heighted">  <!--whether heighted notation-->
	<xsl:choose>
		<xsl:when test="//nxm:notation_x[@heighted]">
			<xsl:choose>
				<xsl:when test="//nxm:notation_x/@heighted='false'">false</xsl:when>
				<xsl:otherwise>true</xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:otherwise>true</xsl:otherwise>
	</xsl:choose>
</xsl:variable>
<xsl:variable name="pitched">  <!--whether pitched notation-->
	<xsl:choose>
		<xsl:when test="//nxm:notation_x[@pitched]">
			<xsl:choose>
				<xsl:when test="//nxm:notation_x/@pitched='true'">true</xsl:when>
				<xsl:otherwise>false</xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:otherwise>true</xsl:otherwise>
	</xsl:choose>
</xsl:variable>

<!--	**************************
	**  Root Node Template  **
-->
<xsl:template match="//nxm:NeumesXML">

<!-- ****** Begin HTML: ****** -->
<!--
Q: How do we get,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
It currently says:
<html xmlns:nxm="http://www.scribeserver.com/NEUMES/xml/NeumesXML">
<head>
-->
	<html>
	<head>
	<title>NEUMES: <xsl:value-of select="//nxm:transcription_title/@content"
	  disable-output-escaping="yes"/></title>


<!-- ****** CSS [client-side]: ****** -->
	<LINK HRef="&std_scripts_path;/NeumesXML_xsl.css" Type="text/css" Rel="stylesheet" />

<!-- ***** JavaScript [client-side execution] ***** -->

	<!--	*************************
		* STAND-ALONE INCLUDES: *
	-->
	<SCRIPT type="text/javascript"
		SRC="&std_scripts_path;/imageprotect.js"></SCRIPT>
	<!-- For importation of a Glyphs Manifest XML file: -->
	<SCRIPT type="text/javascript"
		SRC="&std_scripts_path;/sarissa.js"></SCRIPT>
	<!-- For importation of a Glyphs Manifest XML file (Mozilla compatibility): -->
	<SCRIPT type="text/javascript"
		SRC="&std_scripts_path;/sarissa_ieemu_xpath.js"></SCRIPT>

<!-- Begin, JavaScript in HTML Head -->
<SCRIPT type="text/javascript">

	<!--	**************************
		* INDEPENDENT FUNCTIONS: *

		The following functions have no dependencies.
	-->


	<!--	FN: CONSTRUCTOR FOR GlyphObject
		Create an object for one glyph image from the Glpyhs Manifest XML file.
		Dependencies: none.
	-->
	function glyphObject(description, tones, mnemonic_code, substitute_style, filename,
	  imgWidth, imgHeight, baseline) {
		this.description=description;
		this.tones=tones;
		this.mnemonic_code=mnemonic_code;
		this.substitute_style=substitute_style;
		this.filename=filename;
		this.imgWidth=imgWidth;
		this.imgHeight=imgHeight;
		this.baseline=baseline;
	}  <!--[end, glyphObject constructor]-->


	<!--	********************************
		* JavaScript GLOBAL VARIABLES: *
	-->
	<!-- These vars depend on XSLT: -->
	var heighted=<xsl:value-of select="$heighted"/>; <!--whether symbols have Offsets-->
	var pitched=<xsl:value-of select="$pitched"/>; <!--whether symbols have pitches-->
	<!-- for pulldown(): -->
	var plus_img='&std_img_path;/plus_sm.gif';  <!-- plus sign -->
	var minus_img='&std_img_path;/minus_sm.gif';  <!-- minus sign -->
	<!--[end, dependency]-->

	var filepathValue=''; <!--CONST complete filepath of this NeumesXML file-->
	var globalColorPath=''; <!-- CONST global, append Color subpath if not color==black -->
	var imgColorPath=''; <!-- VAR temp, append Color subpath if not color==black -->
	var heightingFactor=2; <!--CONST multiplicative scaling factor for heights, was 2-->
	<!--baseline in px of the initial glyph (a positive number),
	  measured up from top of containing box:-->
	var transcriptionBaseline=0;  <!-- start position of transcription -->
	var glyphRowHeight=0;
	var heightSum=0; <!--VAR cumulative Tonal Movement to current position-->
	var current_notation=''; <!--String, name of currently-used notation family-->
	var current_lines=0; <!--VAR integer, number of staff lines to show-->
	var native_lines=0; <!--staff lines, as coming from transcription-->
	var staffOffset=0; <!--placement of staff lines image-->
	var imgs_not_found=''; <!--VAR String, glyph image names not found-->
	var imagesLoaded=false; <!--VAR flag, browser done trying to load all images-->
	var scrWidth=800;  <!--default screen width; adjusted in loadfn()-->
	var scrHeight=600;  <!--default screen height; adjusted in loadfn()-->
	<!-- From Calling URL: -->
	var urlParams=null;
	var zoomIndex=0;
	var notationIndex=0;
	var notationValue=''; <!--user-specified notation family, or 'native'-->
	var bgIndex=0;
	var pitchtone_mvmtIndex=0;
	var metadataIndex=0;
	var lmarginIndex=0;
	var rmarginIndex=0;
	var userImgPathIndex=0;
	<!--[end, from Calling URL]-->
	<!-- Open Wait Window: -->
	var waitFile='http://www.scribeserver.com/NEUMES/wait_visualization.htm';
	var centerH=Math.round((screen.width/2)- 45);
	var centerV=Math.round((screen.height/2) - 20);
	var waitWindow=window.open(waitFile, '', 'toolbar=no,location=no,directories=no,' +
	  'status=no,menubar=no,scrollbars=no,resizable=no,left=' + centerH +
	  ',top=' + centerV + ', width=123, height=103');
	<!--[end, open Wait Window]-->
	<!--	for randID(): -->
	var today=new Date();
	var seed=today.getTime();
	<!--Array of glyphObjects for JS local-storage of data from a Glyphs Manifest file:-->
	var glyphObjects=new Array();
	<!-- Warning: check return code from getGlyphObject() before using this Index: -->
	var currentIndexGO=0;  <!--VAR, index of the current glyph in glyphObjects array-->
	<!--VAR flag, true if Glyphs Manifest has been read-in for this glyph image set:-->
	var glyphsManifest=false;
	var glyphsManifestImgFilepath=''; <!--Image filepath in current Glyphs Manifest file-->
	var greatestDescender=888;  <!-- greatest descender in Glyphs Manifest; 888==UNK -->
	var greatestAscender=888;  <!-- greatest ascender in Glyphs Manifest; 888==UNK -->


	<!--	************************
		* DEPENDENT FUNCTIONS: *

		These functions depend on global variables or functions declared above.
	-->

	<!--	FN: LOAD GLYPHS MANIFEST
		Load an external Glyphs Manifest XML file; populate the glyphObjects JS array
		with a glyphObject for each glyph image.

		Post conditions:
		Returns 'true' if loading of Glyphs Manifest XML file was successful:
			glyphsManifest==true;
			glyphObjects==array of glyphObject's from GlyphsManifest;
			currentIndexGO==0;
			glyphsManifestImgFilepath==URL path of glyph image set;
			greatestDescender==greatest descender (pixels) in Glyphs Manifest
			  (a positive int).
			greatestAscender==greatest ascender (pixels) in Glyphs Manifest
			  (a positive int).
		Returns 'false' if loading generated an error, or glyphObjects is now empty:
			glyphsManifest==false;
			glyphObjects==null;
			currentIndexGO==0;
			glyphsManifestImgFilepath=='';
			greatestDescender==888.
			greatestAscender==888.

		Dependencies:
		  Depends on sarissa.js and sarissa_ieemu_xpath.js, and should follow
		    their declarations. [The '@' operators are of sarissa, not of XSLT.]
		  Depends on global vars listed below, and should follow their declarations.
		  Depends on Element names and optionality declared in the glyphs_manifest.xsd.
		  Note: if migrating to external JS file, change the 'lt' Entity.
		HTTP error codes: xmlhttp.status code to see whether it was successful.
		  Anything in the 200s means the file has been found, whereas 404 is the most
		  common (not found) error.
	-->
	function loadGlyphsManifest(manifestURL) {
		<!-- Clear the glyphObjects array, and reset currentIndexGO to 0:
			[Setting the array length to 0 would leave the previous contents of the
			array somewhere in memory; it will be garbage-collected if set to null.]
		-->
		<!-- global vars: -->
		glyphObjects=null;  <!-- mark old glyphsObject array for garbage-collection -->
		glyphsManifest=false;  <!-- flag: no Glyphs Manifest loaded, global -->
		glyphObjects=new Array();  <!-- JS array of glyphObject's from GlyphsManifest -->
		currentIndexGO=0;  <!-- defensive to avoid out-of-bounds reference, global -->
		glyphsManifestImgFilepath='';  <!-- declared globally -->
		greatestDescender=888;  <!-- greatest descender in Glyphs Manifest; 888==UNK -->
		greatestAscender=888;  <!-- greatest ascender in Glyphs Manifest; 888==UNK -->

		<!-- local utility vars: -->
		var xmlhttp;
		var manifest;
		var glyphs;
		var glyph;
		var description;
		var tones;
		var mnemonic_code;
		var substitute_style;
		var filename;
		var width;
		var height;
		var baseline;
		var oGlyph;
		var i;  <!-- local temp index -->
		var j;  <!-- local temp index -->
		var k;  <!-- local temp value holder -->

		<!-- sarissa.js setup: -->
		try {
			xmlhttp=new XMLHttpRequest();  <!-- from sarissa.js ... -->
			xmlhttp.open('GET', manifestURL, false);
			xmlhttp.send('');
			manifest=(new DOMParser()).parseFromString(xmlhttp.responseText,
			  'text/xml');
			manifest.setProperty('SelectionLanguage', 'XPath');
			<!-- Set Xpath namespace: -->
			Sarissa.setXpathNamespaces(manifest,
			  'xmlns:gm="http://www.scribeserver.com/NEUMES/xml/glyphs_manifest"');
			<!-- glyphs is an array of DOM nodes, one for each glyph: -->
			glyphs=manifest.selectNodes('/gm:glyphs_manifest/gm:glyph');
			<!-- Get glyph image filepath specified in the Glyphs Manifest: -->
			glyphsManifestImgFilepath=manifest.selectNodes(
			  '/gm:glyphs_manifest/gm:glyphSetProperties/@virtual_path'); 
		} catch (e) {
			return false;  <!-- failure -->
		}  <!--end, try/catch sarissa-->
		for (i=0; i &lt; glyphs.length; i++) {
			glyph=glyphs[i];
			<!-- no dependency on XSLT: -->
			description=glyph.selectSingleNode('@description').nodeValue;
			tones=glyph.selectSingleNode('@tones').nodeValue;
			mnemonic_code=glyph.selectSingleNode('@mnemonic_code').nodeValue;
			<!-- Remark: substitute style is optional in Glyphs Manifest: -->
			try {
			   substitute_style=glyph.selectSingleNode('@substitute_style').nodeValue;
			} catch (e) {
				substitute_style='';
			}  <!--[end, try/catch substitute style]-->
			filename=glyph.selectSingleNode('@filename').nodeValue;
			width=glyph.selectSingleNode('@width').nodeValue;
			height=glyph.selectSingleNode('@height').nodeValue;
			baseline=glyph.selectSingleNode('@baseline').nodeValue;
			oGlyph=new glyphObject(description, tones, mnemonic_code,
			  substitute_style, filename, width, height, baseline);
			<!-- Index is required: -->
			glyphObjects[i]=oGlyph;
		}  <!--[end, for i]-->
		<!-- Assume that no Glyphs Manifest has only one glyph: -->
		if (i > 0) {
			glyphsManifest=true;  <!-- flag: Glyphs Manifest loaded -->
			greatestDescender=0;  <!-- init -->
			for (j=0; j &lt; glyphObjects.length; j++) {
				k=parseInt(glyphObjects[j].baseline);
				if (k > greatestDescender) {
					greatestDescender=k;
				}  <!--[end, if k]-->
			}  <!--[end, for j]-->
			greatestAscender=0;  <!-- init -->
			for (j=0; j &lt; glyphObjects.length; j++) {
				k=parseInt(glyphObjects[j].imgHeight) -
				  parseInt(glyphObjects[j].baseline);
				if (k > greatestAscender) {
					greatestAscender=k;
				}  <!--[end, if k]-->
			}  <!--[end, for j]-->
			return true;  <!-- success -->
		} else {
			return false;  <!-- failure -->
		}  <!--[end, if/else]-->
	}  <!--[end, loadGlyphsManifest()]-->


	<!--	FN: GET GLYPH OBJECT By FILENAME From GLYPHS MANIFEST
		Searches the glyphObjects array for passed image filename.
		If found, sets the currentIndexGO index of the glyphObjects for this glyph, and
		  returns 'true' (==found).
		If not found, currentIndexGO is unchanged, and returns 'false' (==not found).

		Dependencies: Depends on the global vars glyphObjects and currentIndexGO.
	-->
	function getGlyphObject(filename) {
		for (i=0; i &lt; glyphObjects.length; i++) {
			if (glyphObjects[i].filename == filename) {
				currentIndexGO=i;
				return true;  <!-- found -->
			}  //end, if
		}  //end, for
		return false;  <!-- not found -->
	}  <!--[end, getGlyphObject()]-->


	<!--	FN: OPEN GLYPH ROW
		Opens a Table Row; sets Height according to glyphRowHeight;
		displays background image according to number of staff lines required.
		NOTICE: CSS counts Height and Vertical Offset from *TOP* of the containing box
		to TOP of the offset box.
		First line of 4-line staff is down 30px from top of image; lines are 8px apart.
		TR.lines4, background-position-y MUST be *bottom*.
		TD.neume height of 72 is the height of 4-line staff image [min-height doesn't
		  work]. Add *offsetFloor*.
	-->
	function openGlyphRow() {
<!--xxx Testing: border="1" bordercolor="red" [no effect] -->
		document.write('&lt;TR class="glyphRow" style=\"height:' +
		  glyphRowHeight + 'px; ');
		if (current_lines == 4) {
			<!-- background-position-y is measured from TOP of containing box
			    (glyphs positions are specified up from bottom) -->
			document.write('background-image:' +
			  'url(\'&std_img_path;/shared/staff_4_line.gif\'); ');
			document.write('background-attachment:fixed; background-repeat:repeat-x; ');
			document.write('background-position-y:' + staffOffset + 'px;');
		}
		document.writeln('\">');  <!--end, <TR>-->
	} <!--[end, openGlyphRow()]-->


<!--xxx Testing
var firstTime=0;
 -->
	<!--	FN: DRAW GLYPH
		glyph heighting; eliminate Substitute Style if not Native Notation.
		leadingOffset is vertical distance from previous glyph.
		internalOffset is internal movement for multi-tone glyphs.
		Height scaling factor is multiplied *only* when computing height of
		  this glyph (carried-forward values are in terms of tonal movement).
		Returned leadingOffset of 888 means UNK: reset heightSum to 0 + offsetFloor.

		If CharToShow is a clef, then the leading movement==the line number on the
		staff (1 through 6) of the clef's position; if no position was specified,
		then the line number is 0.
	-->
	function drawGlyph(CharToShow, imgName, leadingMvmt, internalMvmt, certaintyFactor) {

<!--xxx Testing:
if (firstTime == 0) {
	document.write('&lt;IMG SRC=\"' + imgColorPath + 'punctum_1.gif' +
	  '\" HSpace="&vowel_spacer;" Border="0"');
	tempStr=' style=\"position:relative; top:' + 0 + 'px !important;\"';
	document.write(tempStr);
	document.write(' onError=\"imgErr(\'' + imgName + '\');\" alt="">Z');

	document.write('&lt;IMG SRC=\"' + imgColorPath + 'punctum_1.gif' +
	  '\" HSpace="&vowel_spacer;" Border="0"');
	tempStr=' style=\"position:relative; top:-' + glyphRowHeight + 'px !important;\"';
	document.write(tempStr);
	document.write(' onError=\"imgErr(\'' + imgName + '\');\" alt="">H');

	document.write('&lt;IMG SRC=\"' + imgColorPath + 'blueline.gif' +
	  '\" HSpace="&vowel_spacer;" Border="0"');
	tempStr=' style=\"position:relative; top:-' + glyphRowHeight + 'px !important;\"';
	document.write(tempStr);
	document.write(' onError=\"imgErr(\'' + imgName + '\');\" alt="">H');

	firstTime=1;
}  //end, Testing
-->
		var tempStr='';
		var thisOffset=0;
		var tempFound=false;  <!-- if image found in Glyphs Manifest -->
		var tempGlyphBaseline=0;  <!-- baseline of image from Glyphs Manifest -->
		var tempGlyphHeight=0;  <!-- Y-dimension of image from Glyphs Manifest -->
		var cfMsg=''; <!--CF message-->
		<!-- The following two Math operations ARE NECESSARY: -->
		var leadingMvmtNum=Math.round(leadingMvmt);
		var internalMvmtNum=Math.round(internalMvmt);
		if (leadingMvmtNum == 888) { <!--UNK height-->
			leadingMvmtNum=0;
			heightSum=0; <!--reset-->
		}

		<!--Ignore Substitute Style image if not using Native Notation:-->
		if ('native' != notationValue) {
			var imgNameArr=imgName.split('.');
			var i=imgNameArr[0].lastIndexOf('_');
			if (i != -1) {
				imgNameArr[0]=imgNameArr[0].substring(0, i);
				imgNameArr[0]=imgNameArr[0] + '_1';
			}
			imgName=imgNameArr.join('.');
		}

		<!-- Display CF hypercomment if non-10 CF (conditional display): -->
<!-- Testing: height of cf? -->
		if ( ('yes' == pitchtone_mvmtValue) &amp;&amp; (10 != certaintyFactor) ) {
			cfMsg='Certainty factor = ' + certaintyFactor + '.';
			document.write('&lt;A HRef="CF" class="rubric" ' +
			  'onClick=\"noop=pop(\'' + cfMsg + '\'); return false;\">');
		} <!--[end, conditional display]-->

		<!--  NB: this paragraph might be bogus!
			 Calculate descent (counted down from TOP), and DISPLAY:
			CSS counts Vertical Offset from *TOP* of the containing box,
			to *TOP* of the image box. 
		-->
		if (('&doh_clef;' == CharToShow) || ('&fah_clef;' == CharToShow)
		  || ('fah_clef_1.gif' == imgName) || ('fah_clef_2.gif' == imgName) ) {
			<!-- First line of 4-line staff is down 30px from top of image; lines are
				8px apart; baseline of clefs is 8 pixels down from top of clef image.
Testing:
			thisOffset= -(staffOffset - ((current_lines - leadingMvmtNum) * 8) +4);
			-->
			thisOffset= (transcriptionBaseline + staffOffset) * heightingFactor + 4;
		} else {
			thisOffset= transcriptionBaseline + ((heightSum + leadingMvmtNum) *
			  heightingFactor);
			<!-- BOGUS? Count down from top of containing box: -->
			var tempGlyphYPos = glyphRowHeight - thisOffset;
			<!-- Push BOTTOM of Img up (neg number) from bottom of containing box: -->
			var tempGlyphYPos = -thisOffset;
			<!--Seek filename; currentIndexGO is index of correct image, if found:-->
			tempFound=getGlyphObject(imgName);
			if (tempFound) {
				tempGlyphBaseline=parseInt(glyphObjects[currentIndexGO].baseline);
				tempGlyphHeight=parseInt(glyphObjects[currentIndexGO].imgHeight);
				<!-- pull IMG down to baseline of glyph: -->
				tempGlyphYPos=tempGlyphYPos + tempGlyphBaseline;
			}  <!--[end, if image found]-->
		}
		document.write('&lt;IMG SRC=\"' + imgColorPath + imgName +
		  '\" HSpace="&vowel_spacer;" Border="0"');
		tempStr=' style=\"position:relative; top:' + tempGlyphYPos + 'px !important;\" ';
		document.write(tempStr);
<!-- TO DO: use name from glyphs manifest instead of imgName: -->
		document.write('onError=\"imgErr(\'' + imgName + '\');\" alt="' +
		  imgName + '">');

		<!-- Close CF link if open: -->
		if ( (pitchtone_mvmtValue == 'yes') &amp;&amp; (certaintyFactor != 10) ) {
			document.write('&lt;span style=\"display:inline; vertical-align:' +
			  thisOffset + ';\">&cf;&lt;/span>&lt;/A>');
		}
		<!-- Don't add to cumulative height if Special Char: -->
		if ( ('&custos;' == CharToShow) || ('&ut_supra;' == CharToShow) ||
		  ('&doh_clef;' == CharToShow) || ('&fah_clef;' == CharToShow) ) {
			// noop
		} else {
			heightSum=(heightSum + leadingMvmtNum + internalMvmtNum);
		}
	} <!--[end, drawGlyph()]-->


	<!--	FN: SET STAFF LINES
		Set current_lines and calculate staffOffset.
		staffOffset is measured from TOP.
		Assume glyphRowHeight is set correctly.
		Preconditions:
		  glyphRowHeight and transcriptionBaseline must already have been calculated.
	-->
	function setStaffLines() {
		var staffMiddleDepth=0; <!--distance from TOP of staff image to middle space-->

		if (notationValue == 'native') { <!--use staff lines coming from transcription-->
			current_lines=native_lines; <!--initially 0-->
		<!-- User is forcing to different notation: -->
		} else if (current_notation == 'Aquitanian') {
			current_lines=0;
		} else if (current_notation == 'Middle_Byzantine') {
			current_lines=0;
		} else if (current_notation == 'Post_Byzantine') {
			current_lines=0;
		} else if (current_notation == 'Sarum') {
			current_lines=4;
		} else if (current_notation == 'square') {
			current_lines=4;
		} else if (current_notation == 'St_Gall') {
			current_lines=0;
		} else { <!-- default: -->
			current_lines=5; <!--for dothead notation-->
		}
		<!--	Calculate Staff Position: -->
		if (current_lines == 4) {
			staffMiddleDepth=(30 + 12); <!--dist from 4-line staff img TOP to
			  middle space. Staff is 72px high; this number is correct-->
		}
<!--xxx Testing:
staffMiddleDepth=(30 + 12);
		staffOffset=(-glyphRowHeight + transcriptionBaseline + staffMiddleDepth -3);
-->
		staffOffset=(-glyphRowHeight + transcriptionBaseline + staffMiddleDepth +18 +3);
	}
	<!--[end, setStaffLines()]-->


	<!--	FN: ONLOAD
	-->
	function loadfn() {
		<xsl:if test="$discipline != 'Western'">
			document.redisplayForm.notation_family.disable;
			document.redisplayForm.notation_family.style.backgroundColor="gray";
<!--	<INPUT type="HIDDEN" name="notation_family" value="native"> -->
		</xsl:if>
		waitWindow.close();
		<!-- Try to set window to full-screen: -->
		try {
			scrWidth=self.screen.width;
			scrHeight=self.screen.availHeight;
			self.resizeTo(scrWidth, scrHeight);
			self.moveTo(0,0);
		} catch (e) {
			// noop
		}
		// Gain focus:
		if (window.focus) {
			self.focus();
		}
		<!-- Timer: -->
//		var endTime=new Date();
//		var elapsed=endTime - startTime;
//		alert('Loading time = ' + elapsed);
	} <!--[end, loadfn()]-->



	<!--	***************************
		* JavaScript INLINE CODE: *

		Remark: local vars are declared inline, as needed.
	-->
	if (window.focus) {
		waitWindow.focus();  <!-- focus on small Wait window -->
	}
	<!-- Timer: -->
//	var startTime=new Date();

	<!--	HANDLE PARAMETERS IN CALLING URL:
	-->
	<!--	Normalise and decompose the calling URL: -->
	var newWindowValue='no'; <!--re: Redraw in a new window-->
	var callingURL=window.location.href;
	if (callingURL.indexOf('?') == -1) {
		callingURL=callingURL + '?';
	}
	var urlQuery=callingURL.split('?');
	<!-- Add 'zoom' parameter if absent in URL: -->
	if (urlQuery[1].indexOf('&amp;zoom=') == -1) {
		urlQuery[1]=urlQuery[1] + '&amp;zoom=100';
	}
	<!-- Add 'notation' param if absent in URL, set it to 'native': -->
	if (urlQuery[1].indexOf('&amp;notation=') == -1) {
		urlQuery[1]=urlQuery[1] + '&amp;notation=native';
	}
	<!-- Add 'bg' param if absent in URL: -->
	if (urlQuery[1].indexOf('&amp;bg=') == -1) {
		urlQuery[1]=urlQuery[1] + '&amp;bg=parch';
	}
	<!-- Add 'pitchtone_mvmt' param if absent in URL: -->
	if (urlQuery[1].indexOf('&amp;pitchtone_mvmt=') == -1) {
		urlQuery[1]=urlQuery[1] + '&amp;pitchtone_mvmt=yes';
	}
	<!-- Add 'metadata' param if absent in URL: -->
	if (urlQuery[1].indexOf('&amp;metadata=') == -1) {
		urlQuery[1]=urlQuery[1] + '&amp;metadata=yes';
	}
	<!-- Add 'lmargin' param if absent in URL: -->
	if (urlQuery[1].indexOf('&amp;lmargin=') == -1) {
		urlQuery[1]=urlQuery[1] + '&amp;lmargin=6';
	}
	<!-- Add 'rmargin' param if absent in URL: -->
	if (urlQuery[1].indexOf('&amp;rmargin=') == -1) {
		urlQuery[1]=urlQuery[1] + '&amp;rmargin=6';
	}
	<!-- Add 'imgpath' param if absent in URL: -->
	if (urlQuery[1].indexOf('&amp;imgpath=') == -1) {
		urlQuery[1]=urlQuery[1] + '&amp;imgpath=';
	}

	<!-- vars declared in this section record just the Redisplay Options: -->
	urlParams = urlQuery[1].split('&amp;'); <!--global-->
	<!-- Isolate the source filepath parameter value: -->
	for (i in urlParams) {
		if (urlParams[i].indexOf('&file_parm_name;=') != -1) {
			filepathValue=urlParams[i].substring(urlParams[i].indexOf('=')+1,
			  urlParams[i].length);
		}
	}
	<!-- Isolate the 'zoom' param index and value: -->
	zoomIndex=0; <!--global-->
	var zoomValue='';
	for (i in urlParams) {
		if (urlParams[i].indexOf('zoom=') != -1) {
			zoomIndex=i;
			zoomValue=urlParams[i].substring(urlParams[i].indexOf('=')+1,
			  urlParams[i].length);
		}
	}
	<!-- Isolate the 'notation' param index and value: -->
	notationIndex=0; <!--global-->
	notationValue=''; <!--global-->
	for (i in urlParams) {
		<!-- User override, or 'native' if not overridden: -->
		if (urlParams[i].indexOf('notation=') != -1) {
			notationIndex=i;
			notationValue=urlParams[i].substring(urlParams[i].indexOf('=')+1,
			  urlParams[i].length);
		}
	}

	<!--	*** SET CURRENT NOTATION: ***	-->

	if('native' == notationValue) {
		current_notation='<xsl:value-of select="$notation_family"/>';
	} else {
		current_notation=notationValue; <!--user override-->
	}
	<!-- Isolate the 'bg' param index and value: -->
	bgIndex=0; <!--global-->
	var bgValue='';
	for (i in urlParams) {
		if (urlParams[i].indexOf('bg=') != -1) {
			bgIndex=i;
		  bgValue=urlParams[i].substring(urlParams[i].indexOf('=')+1,urlParams[i].length);
		}
	}
	<!-- Isolate the 'pitchtone_mvmt' param index and value: -->
	pitchtone_mvmtIndex=0; <!--global-->
	var pitchtone_mvmtValue='';  <!--whether user wants display of Pitch & Mvmt rows-->
	for (i in urlParams) {
		if (urlParams[i].indexOf('pitchtone_mvmt=') != -1) {
			pitchtone_mvmtIndex=i;
			pitchtone_mvmtValue=urlParams[i].substring(urlParams[i].indexOf('=')+1,
			  urlParams[i].length);
		}
	}
	<!-- Isolate the 'metadata' param index and value: -->
	metadataIndex=0; <!--global-->
	var metadataValue='';
	for (i in urlParams) {
		if (urlParams[i].indexOf('metadata=') != -1) {
			metadataIndex=i;
			metadataValue=urlParams[i].substring(urlParams[i].indexOf('=')+1,
			  urlParams[i].length);
		}
	}
	<!-- Isolate the 'lmargin' param index and value: -->
	lmarginIndex=0; <!--global-->
	var lmarginValue='';
	for (i in urlParams) {
		if (urlParams[i].indexOf('lmargin=') != -1) {
			lmarginIndex=i;
			lmarginValue=urlParams[i].substring(urlParams[i].indexOf('=')+1,
			  urlParams[i].length);
		}
	}
	<!-- Isolate the 'rmargin' param index and value: -->
	rmarginIndex=0; <!--global-->
	var rmarginValue='';
	for (i in urlParams) {
		if (urlParams[i].indexOf('rmargin=') != -1) {
			rmarginIndex=i;
			rmarginValue=urlParams[i].substring(urlParams[i].indexOf('=')+1,
			  urlParams[i].length);
		}
	}
	<!-- Isolate the 'imgpath' param index and value: -->
	userImgPathIndex=0; <!--global-->
	var userImgPathValue=null;
	for (i in urlParams) {
		if (urlParams[i].indexOf('imgpath=') != -1) {
			userImgPathIndex=i;
			<!-- "unescape" normalizes the URL to plaintext: -->
			userImgPathValue=
			  unescape(urlParams[i].substring(urlParams[i].indexOf('=')+1,
			  urlParams[i].length));
		}
	}
	<!--[end, Handle Parameters in Calling URL]-->


	<!--	*** SET BASE PATH FOR GLYPHS: ***

		Note: this section must follow "Handle Parameters in Calling URL".
		Precedence: user-specified; transcription-specified; standard path.
		"imgBasePath" is temporary and local to this block only.
		If user-specified then userImgPathValue will be non-empty.
	-->
	var imgBasePath=''; <!--LOCAL/TEMP basepath of glyphs (not of navigation icons)-->
	<xsl:if test="//nxm:glyphs_resource[@glyph_path]">
		imgBasePath='<xsl:value-of select="//nxm:glyphs_resource/@glyph_path"/>';
	</xsl:if>
	<!-- Case 1: User override: -->
	if ('' != userImgPathValue) {
		<!-- TO DO, Temporary solution (need to allow user-supplied manifest): -->
		document.write('&lt;BASE HRef=\"' + userImgPathValue + '\">');
	}
<!--xxx To do: Change in NeumesXML Schema, URL of Glyphs Manifest specified, not img path. -->
	<!-- Case 2: filepath specified in the NeumesXML file: -->
	else if ('' != imgBasePath) {
		<!-- TO DO, Temporary solution (need to provide for a manifest): -->
		document.write('&lt;BASE HRef=\"' + imgBasePath + '\">');
	}
	<!-- Case 3: use standard image paths: -->
	else {
		if (current_notation == 'Aquitanian') {
			glyphsManifest=loadGlyphsManifest('&std_img_path;' +
			  '/aquitanian/aquitanian_manifest.xml');
			if (glyphsManifest) {  <!-- TO DO: get img path from Glyphs Manifest -->
				imgBasePath='&std_img_path;/aquitanian/';
			} else {
				imgBasePath='&std_img_path;/aquitanian/';
			}  <!--[end, if/else glyphsManifest]-->
		} else if (current_notation == 'Middle_Byzantine') {
			glyphsManifest=false;  <!-- no Manifest -->
			imgBasePath='&std_img_path;/middle_byzantine/';
		} else if (current_notation == 'Post_Byzantine') {
			glyphsManifest=false;  <!-- no Manifest -->
			imgBasePath='&std_img_path;/post_byzantine/';
		} else if (current_notation == 'Sarum') {
			glyphsManifest=loadGlyphsManifest('&std_img_path;' +
			  '/sarum/sarum_manifest.xml');
			imgBasePath='&std_img_path;/sarum/';
		} else if (current_notation == 'square') {
			glyphsManifest=loadGlyphsManifest('&std_img_path;' +
			  '/square/square_manifest.xml');
			imgBasePath='&std_img_path;/square/';
		} else if (current_notation == 'St_Gall') {
			glyphsManifest=loadGlyphsManifest('&std_img_path;' +
			  '/st_gall/st_gall_manifest.xml');
			imgBasePath='&std_img_path;/st_gall/';
		} else { <!-- Default: -->
			glyphsManifest=loadGlyphsManifest('&std_img_path;' +
			  '/square/square_manifest.xml');
			imgBasePath='&std_img_path;/square/'; <!-- TO DO Change to dothead -->
		}  <!--[end, if/else current_notation]-->
		<!-- WRITE imgBasePath to HTML as the document BASE: -->
		document.write('&lt;BASE HRef=\"' + imgBasePath + '\">');
	} <!--[end, Case 3]-->
	<!--[end, Set BASE Path for Glyphs]-->


	<!--	CALCULATE LOWEST AND HIGHEST TONAL MOVEMENT FROM FIRST GLYPH:
		[Temporary code]
		Set the baseline offset (in pixels) for glyphs according to Tonal Movement bounds.
		Note: this section must follow "Set BASE Path for Glyphs" for glyph dimensions,
		and call to loadGlyphsManifest() for value of greatestDescender and
		greatestAscender.
	-->
	var tempMaxDescender=56; <!--Hack: in absence of a Glyphs Manifest-->
	if (greatestDescender &lt; 888) {
		tempMaxDescender=greatestDescender;
	}
	var tempMaxAscender=56; <!--Hack: in absence of a Glyphs Manifest-->
	if (greatestAscender &lt; 888) {
		tempMaxAscender=greatestAscender;
	}
	var offsetFloor=0; <!-- greatest px offset below transcriptionBaseline -->
	var offsetCeiling=0; <!--greatest px offset above transcriptionBaseline-->
	<xsl:if test="$heighted='true'">
		<xsl:variable name="multiVal"> <!--a multi-valued string is generated-->
			<xsl:call-template name="GetTonalMvmtBounds"/>
		</xsl:variable>
		<!-- unpack *multiVal* (comma-delimited string); set global vars: -->
		<xsl:variable name="movementFloor" select="substring-before($multiVal, ',')"/>
		<xsl:variable name="movementCeiling" select="substring-after($multiVal, ',')"/>
		<!-- Value of maximumTonesDown is a negative number: -->
		var maximumTonesDown=<xsl:value-of select="$movementFloor"/>;
		if (maximumTonesDown >= 0) {
			offsetFloor=tempMaxDescender;
		} else {
			<!-- Reverse polarity of maximumTonesDown: -->
			offsetFloor= -(maximumTonesDown * heightingFactor) +
			  tempMaxDescender;
		}
		var maximumTonesUp=<xsl:value-of select="$movementCeiling"/>;
		if (0 >= maximumTonesUp) {
			offsetCeiling=tempMaxAscender;
		} else {
			offsetCeiling=(maximumTonesUp * heightingFactor) +
			  tempMaxAscender;
		}
	</xsl:if>

	glyphRowHeight=offsetFloor + offsetCeiling; <!--all global-->
	transcriptionBaseline=offsetFloor;  <!-- Number of pixels down -->

	<!-- Call must follow assignment of notationValue and current_notation, and
		calculation of glyphRowHeight and transcriptionBaseline: -->
	setStaffLines(); <!--calculate staffOffset-->

</SCRIPT><!--[end, JavaScript in HTML Head]-->

	<!--	***********************
		* DEPENDENT INCLUDES: *
		Dependencies on foregoing inline code.
		Defensive coding: since JS is an interpreted language, forward references ought
		not be used; i.e., a function or variable must be defined at the time it is
		referenced. In principle, JS allows forward references to *inline* functions
		because it scans the code for all function definitions before it executes the
		code. You can't, however, have a forward reference from one 'imported' SCRIPT
		element to another. 
	-->
	<SCRIPT type="text/javascript"
		SRC="&std_scripts_path;/NeumesXML_xsl.js"></SCRIPT>

	</head>

	<!--	**************
		* HTML BODY: *
	-->
	<SCRIPT type="text/javascript">
	document.write('&lt;BODY onLoad="loadfn();" ');
	if ('white' == bgValue) {
		document.write('BGColor="#FCFCFC">');
	} else {
		document.write('BGColor="#E6E3A0" Background="&std_img_path;/parch3.jpg">');
	}
	</SCRIPT>

	<!-- Warn non-JavaScript browsers [DO NOT break these lines]: -->
	<SCRIPT type="text/javascript">
	<xsl:text disable-output-escaping="yes">
	&lt;!-- --> &lt;TABLE CellPadding="3" CellSpacing="0" Border="1" BGColor="#E0E0E0" BorderColor="#7A0805">&lt;TR>&lt;TD>
	&lt;!-- --> &lt;IMG Width="34" Height="31" SRC="&std_img_path;/exclamation.gif" HSpace="5" Align="absmiddle" alt="" />
	&lt;!-- --> &lt;FONT Color="#7A0805" Size="1">&lt;B>JavaScript is &lt;U>REQUIRED&lt;/U> for this visualization.&lt;BR />
	&lt;!-- --> &nbsp;Please enable JavaScript, or upgrade your browser if necessary.&nbsp;&lt;/B>&lt;/FONT>
	&lt;!-- --> &lt;/TD>&lt;/TR>&lt;/TABLE>&lt;BR />
	</xsl:text>
	</SCRIPT>
	<NOSCRIPT>
	<TABLE CellPadding="3" CellSpacing="0" Border="1" BGColor="#E0E0E0"
		BorderColor="#7A0805"><TR><TD>
	<IMG Width="34" Height="31" SRC="&std_img_path;/exclamation.gif" HSpace="5"
	  style="vertical-align:middle;" alt="" />
	<FONT Color="#7A0805"><B>JavaScript is <U>REQUIRED</U> for this visualization.<BR />
		&nbsp;Please enable JavaScript, or upgrade your browser if necessary.&nbsp;
		</B></FONT>
	</TD></TR></TABLE><BR />
	</NOSCRIPT>
	<!--[end, non-JavaScript browser]-->

	<DIV style="text-align:center;">
	<!--  Disclaimer (conditional display): -->
	<SCRIPT type="text/javascript">
	if ('yes' == metadataValue) {
		document.write('&lt;H3 Align="center">&lt;FONT Face="&verdana;" Color="green" ' +
		  'Size="-1">');
		document.write('&lt;I>&lt;B>&lt;U>&lt;FONT Color="maroon">' +
		  'Please note&lt;/U>:&lt;/B>&lt;/FONT>');
		document.write(' This &lt;/I>beta-test&lt;I> visualization of the transcription' +
		  ' is used for testing the underlying software.&lt;BR>' +
		  'Improved visualization programs will follow.&lt;/I>');
		document.write('&lt;/FONT>&lt;/H3>');
	}
	</SCRIPT>

	<!--	*****************************
		*** BEGIN META-DATA BLOCK ***
	-->
	<!--  META-DATA BLOCK (conditional display): -->
<!--Make this an overridable template call: -->
	<SCRIPT type="text/javascript">
	document.write('&lt;TABLE CellPadding="7" CellSpacing="1" Border="5" ' +
	  'BGColor="#CFCFCF" BorderColorLight="#909000" BorderColorDark="#E6EA33" ');
	if ('yes' == metadataValue) {
		document.write('style="margin:auto;">');
	} else {
		document.write('style="display:none; margin:auto;">');
	}
	</SCRIPT>
	<TR>
	<TD Colspan="2" Align="center">
		<TABLE Width="100%" CellSpacing="0" CellPadding="3"><TR VAlign="top">
		<TD Width="100" style="color:maroon;
		  font-size:smaller;"><B>Visualization<BR /><I>version</I>&nbsp;
		<SCRIPT type="text/javascript">
		document.write('&version_this;');
		</SCRIPT>
		</B></TD>
		<!-- Generate random Window ID, modulo 999: -->
		<TD style="text-align:center; font-size:larger;">|= NeumesXML document
			description =|</TD>
		<TD Width="100" style="text-align:right; color:maroon; font-size:smaller;
			font-weight:bold;">Window ID:
			<SCRIPT type="text/javascript">document.write(randID(999));</SCRIPT><BR />
			<IMG Width="36" Height="14" SRC="&std_img_path;/xml_std.gif" Align="right"
			  HSpace="6" alt="" />
		</TD>
		</TR></TABLE>
<!--End, make this an overridable template call. -->
	<FONT Color="blue"><H3>
	<xsl:value-of select="//nxm:transcription_title/@content"
		disable-output-escaping="yes"/></H3></FONT>
	</TD>
	</TR>

	<!-- Identity: -->
	<TR VAlign="top">
	<TD Width="37%">
	<FONT Size="-1">
	<CENTER><FONT FACE="&verdana;" Color="green">
	<B>Source Identity</B></FONT>
	</CENTER>
	<HR Width="86%" />
	<B>Title:</B>&nbsp;<xsl:value-of select="//nxm:transcription_title/@content"
		disable-output-escaping="yes"/><BR />
	<CENTER><FONT Color="green"><B>- Attribution -</B></FONT>&nbsp;&nbsp;</CENTER>
	<B>Discipline:</B>&nbsp;<xsl:value-of select="$discipline"/><BR />
	<B>Language of chant text:</B>&nbsp;<xsl:value-of
		select="//nxm:language_x/@content"/><BR />
	<B>Notation family:</B>&nbsp;<xsl:value-of select="$notation_family"/><BR />
	<xsl:if test="//nxm:notation_x[@species]">
		<B>Notation species:</B>&nbsp;<xsl:value-of
		select="//nxm:notation_x/@species"/><BR />
	</xsl:if>
	<B>Date range:</B>&nbsp;
	<xsl:choose>
		<xsl:when test="//nxm:attribution[nxm:date_range]">
			<xsl:value-of select="//nxm:attribution/nxm:date_range/@content"/>
		</xsl:when>
		<xsl:otherwise>
			[unavailable]
		</xsl:otherwise>
	</xsl:choose>
	<BR />
	<xsl:if test="//nxm:accession_x[nxm:rite]">
		<B>Rite:</B>&nbsp;<xsl:value-of select="//nxm:rite/@group"/><BR />
	</xsl:if>
	<xsl:if test="//nxm:accession_x[nxm:rite_x]">
		<B>Rite:</B>&nbsp;<xsl:value-of select="//nxm:rite_x/@group"/>
		<xsl:if test="//nxm:rite_x[@subgroup]">
			&nbsp;&nbsp;&nbsp;<xsl:value-of select="//nxm:rite_x/@subgroup"/>
		</xsl:if>
		<BR />
	</xsl:if>
	<xsl:if test="//nxm:accession_x[nxm:service]">
		<B>Service:</B>&nbsp;<xsl:value-of select="//nxm:service/@group"/><BR />
	</xsl:if>
	<xsl:if test="//nxm:accession_x[nxm:service_x]">
		<B>Service:</B>&nbsp;<xsl:value-of select="//nxm:service_x/@group"/>
		<xsl:if test="//nxm:service_x[@subgroup]">
			&nbsp;&nbsp;&nbsp;<xsl:value-of select="//nxm:service_x/@subgroup"/>
		</xsl:if>
		<BR />
	</xsl:if>
	<xsl:if test="//nxm:accession_x[nxm:genre_x]">
		<B>Genre:</B>&nbsp;<xsl:value-of select="//nxm:genre_x/@group"/>&nbsp;
			&nbsp;&nbsp;&nbsp;
		<xsl:if test="//nxm:genre_x[@subgroup]">
			<B>Subtype:</B>&nbsp;<xsl:value-of select="//nxm:genre_x/@subgroup"/>
		</xsl:if>
		<BR />
	</xsl:if>
	<xsl:if test="//nxm:accession_x[nxm:occasion]">
		<B>Occasion:</B>&nbsp;<xsl:value-of select="//nxm:occasion/@celebration"/><BR />
	</xsl:if>

	<CENTER><FONT Color="green"><B>- Accession -</B></FONT>&nbsp;&nbsp;</CENTER>
	<B>Incipit:</B>&nbsp;<xsl:value-of select="//nxm:incipit/@content"
		disable-output-escaping="yes"/><BR />
	<xsl:if test="//nxm:accession_x[nxm:siglum]">
		<B>Siglum:</B>&nbsp;<xsl:value-of select="//nxm:siglum/@content"/><BR />
	</xsl:if>
	<xsl:if test="//nxm:accession_x[nxm:location]">
		<B>Location:</B>&nbsp;<xsl:value-of select="//nxm:location/@content"/><BR />
	</xsl:if>
	<xsl:if test="//nxm:accession_x[nxm:cao]">
		<B>CAO:</B>&nbsp;<xsl:value-of select="//nxm:cao/@content"/>&nbsp;
			&nbsp;&nbsp;&nbsp;<BR />
	</xsl:if>
	<xsl:if test="//nxm:accession_x[nxm:concordance]">
		<B>Concordance:</B>&nbsp;<xsl:value-of select="//nxm:concordance/@content"/><BR />
	</xsl:if>

	<CENTER><FONT Color="green"><B>- Physical Description -</B></FONT>&nbsp;</CENTER>
	<B>Dimensions of manuscript:</B><BR />
	<xsl:choose>
		<xsl:when test="//nxm:physical_description[nxm:dimensions]">
			Height = <xsl:value-of
				select="//nxm:physical_description/nxm:dimensions/@height"/>
			&nbsp;<xsl:value-of
				select="//nxm:physical_description/nxm:dimensions/@unit_of_measure"/>
			.&nbsp;Width = <xsl:value-of
				select="//nxm:physical_description/nxm:dimensions/@width"/>
			&nbsp;<xsl:value-of
				select="//nxm:physical_description/nxm:dimensions/@unit_of_measure"/>
		</xsl:when>
		<xsl:otherwise>
			Height = [unavailable].&nbsp;Width = [unavailable]
		</xsl:otherwise>
	</xsl:choose>
	<BR />

	<xsl:if test="//nxm:physical_description[nxm:layout]">
		<B>Layout:</B>&nbsp;
		<xsl:value-of
			select="//nxm:physical_description/nxm:layout/@description"
			disable-output-escaping="yes"/>
		<BR />
	</xsl:if>

	<xsl:if test="//nxm:attribution[nxm:provenance]">
		<CENTER><FONT Color="green"><B>- Manuscript Provenance -</B></FONT>&nbsp;&nbsp;</CENTER>
		<xsl:for-each select="//nxm:attribution/nxm:provenance">
			<IMG Width="0" Height="19" SRC="&std_img_path;/spacer1.gif"
			  style="vertical-align:bottom;" alt="" />&bullet;
			<xsl:value-of select="self::node()/@content"
			disable-output-escaping="yes"/><BR />
		</xsl:for-each>
	</xsl:if>

	<xsl:if test="//nxm:attribution[nxm:cultural_context]">
		<CENTER><FONT Color="green"><B>- Cultural Context -</B></FONT>&nbsp;&nbsp;</CENTER>
		<xsl:value-of select="//nxm:attribution/nxm:cultural_context/@content"/><BR />
	</xsl:if>

	<xsl:if test="//nxm:description_part[nxm:bibliographic_reference]">
		<CENTER><FONT Color="green"><B>- Bibliographic References -</B></FONT>&nbsp;&nbsp;</CENTER>
		<xsl:for-each select="//nxm:description_part/nxm:bibliographic_reference">
			<IMG Width="0" Height="19" SRC="&std_img_path;/spacer1.gif"
			  style="vertical-align:bottom;" alt="" />&bullet;
			<xsl:value-of select="self::node()/@description"
			disable-output-escaping="yes"/><BR />
		</xsl:for-each>
	</xsl:if>

	<xsl:if test="//nxm:description_part[nxm:content_link]">
		<CENTER><FONT Color="green"><B>- Content Hyperlinks -</B></FONT>&nbsp;&nbsp;</CENTER>
		<xsl:for-each select="//nxm:description_part/nxm:content_link">
			<A class="norm" HRef="{self::node()/@link}" Target="link_page">
			<xsl:value-of select="self::node()/@content"/></A><BR />
		</xsl:for-each>
	</xsl:if>

	</FONT>
	</TD>

	<!-- Transcription Chronicle: -->
	<TD>
	<FONT Size="-1">
	<CENTER><FONT FACE="&verdana;" Color="green">
	<B>Transcription Chronicle</B></FONT></CENTER>
	<HR Width="86%" />
	<B>Meta-data encoding:</B>&nbsp;
	<xsl:value-of select="//nxm:encoding_declaration/@description"/>,&nbsp; version&nbsp;
	<xsl:value-of select="//nxm:encoding_declaration/@version"/><BR />
	<B>Transcription-data encoding:</B> NEUMES, version 2.2.b (<i>beta</i>-test)<BR />
	<HR Width="87%" />
	<xsl:for-each select="//nxm:transcription_log">
		<B>Project:</B>&nbsp;
		<xsl:value-of select="self::node()/nxm:project/@project_name"
		disable-output-escaping="yes"/><BR />

		<xsl:if test="self::node()/nxm:project[@project_description]">
			<xsl:value-of
				select="self::node()/nxm:project/@project_description"
				disable-output-escaping="yes"/><BR />
		</xsl:if>
		<xsl:if test="self::node()[nxm:editorial_procedures]">
			<B>Editorial Procedures:</B>&nbsp;
			<A class="norm"><xsl:attribute name="href">javascript:var y=confirm
			("<xsl:value-of
				select="self::node()/nxm:editorial_procedures/@description"
				disable-output-escaping="yes"/>")</xsl:attribute>view</A><BR />
		</xsl:if>
		<xsl:for-each select="self::node()/nxm:transcription_statement">
			<IMG Width="0" Height="20" SRC="&std_img_path;/spacer1.gif"
			  style="vertical-align:bottom;" alt="" />&bullet;
			<xsl:if test="self::node()/nxm:version_identifier[@nr]">
				<B>Transcription Version:</B>&nbsp;
				<xsl:value-of
				  select="self::node()/nxm:version_identifier/@nr"/>
				&nbsp;&nbsp;&nbsp;&nbsp; 
			</xsl:if>
			<B>Date:</B>&nbsp;
			<xsl:value-of select="self::node()/nxm:transcription_date/@content"/><BR />
			<B>Transcriber:</B>&nbsp;
			<xsl:value-of select="self::node()/nxm:transcriber/@content"
				disable-output-escaping="yes"/><BR />
			<xsl:if test="self::node()/nxm:version_identifier[@description]">
				<B>Description:</B>&nbsp;
				<xsl:value-of
					select="self::node()/nxm:version_identifier/@description"/>
				<BR />
			</xsl:if>
			<xsl:if test="self::node()[nxm:edition_comments]">
				<B>Edition comments:</B>&nbsp;
				<A class="norm"><xsl:attribute name="href">javascript:var y=confirm
				("<xsl:value-of select="self::node()/nxm:edition_comments/@content"
				disable-output-escaping="yes"/>")</xsl:attribute>view</A><BR />
			</xsl:if>
			<!-- Copyright notice (separate copyrights OK for different versions): -->
			<xsl:if test="self::node()[nxm:copyright_statement]">
				<B>Copyright notice:</B>&nbsp;<FONT Color="green">
				<xsl:value-of select="self::node()/nxm:copyright_statement/@content"
				disable-output-escaping="yes"/></FONT><BR />
			</xsl:if>
		</xsl:for-each>
		<HR Width="42%" />
	</xsl:for-each>
	</FONT>
	</TD>
	</TR>
	<xsl:if test="//nxm:transcription_part[nxm:edited_text]">
		<TR>
		<TD Colspan="2">
		  &nbsp;<B>Edited chant text:</B><br />
		  &nbsp;<xsl:value-of select="//nxm:edited_text/@content"/>
		</TD>
		</TR>
	</xsl:if>

	<SCRIPT type="text/javascript">
		document.write('&lt;/TABLE>');
	</SCRIPT>
	<BR clear="left" />
	</DIV>

	<!--	***********************************
		*** BEGIN DISPLAY OPTIONS BLOCK ***
	-->
	<DIV style="text-align:center;">
	<!--  DISPLAY OPTIONS BLOCK (conditional display): -->
	<SCRIPT type="text/javascript">
	document.write('&lt;TABLE Width="100%" CellPadding="6" CellSpacing="1" Border="5" ' +
	  'BGColor="#CFCFCF" BorderColorLight="#909000" BorderColorDark="#E6EA33" ');
	if ('yes' == metadataValue) {
		document.write('style="margin:auto;">');
	} else {
		document.write('style="display:none; margin:auto;">');
	}
	</SCRIPT>
	<TR VAlign="top">
	<TD Align="center">
		<TABLE Width="100%" CellPadding="0" CellSpacing="0">
		<colgroup><col width="78" /><col width="*" /><col width="78" /></colgroup>
		<tbody>
		<TR valign="middle">
		<TD Background="&std_img_path;/blueshade_bg.gif"><IMG Width="52" Height="40"
		  SRC="&std_img_path;/neumes_logo.gif" HSpace="3" VSpace="2" alt="" /></TD>
		<TD Align="center" Background="&std_img_path;/blueshade_bg.gif"><span
		  class="times lg myblue">|= <b>NEUMES&nbsp;</b>transcription =|</span></TD>
<!-- BOGUS: next TD style, vertical-align:top; ... also anchor style="" -->
		<TD style="background-image:url('&std_img_path;/blueshade_bg.gif');
		  text-align:right;"><span class="verdana sm red">Legend:<a href="#"
		  onClick="javascript:noop=pulldown('Legend'); if(blur) this.blur();
		  return false;"><IMG ID="Legend-control" Width="14" Height="14"
		  SRC="&std_img_path;/plus_sm.gif" HSpace="5" VSpace="2" border="0"
		  style="vertical-align:middle;" alt="open/close" /></a><br
		  clear="right" />Options:<a style="" href="#"
		  onClick="javascript:noop=pulldown('Options'); if(blur) this.blur();
		  return false;"><IMG ID="Options-control" Width="14" Height="14" HSpace="4"
		  SRC="&std_img_path;/plus_sm.gif" border="0" style="vertical-align:middle;"
		  alt="open/close" /></a></span></TD>
		</TR></tbody></TABLE>
	</TD></TR>
	<TR ID="Legend" style="display:none;"><TD>
		<table style="text-align:left;" Width="100%" cellSpacing="0" cellPadding="0">
		<colgroup><col width="140" /><col width="*" /></colgroup>
		<tbody><tr><td>
			<!-- Line Guide: -->
			<TABLE cellSpacing="0" cellPadding="2" border="1"
			  style="display:inline; margin-left:5px; margin-right:15px;">
			<CAPTION VAlign="top" Align="left">
			<span class="verdana med blue bold">&nbsp;Line Guide:</span>
			</CAPTION>
			<TBODY>
			<TR>
			<TD Background="&std_img_path;/parch3.jpg"><span
			  class="verdana sm black bold">&nbsp;Neumatic glyphs&nbsp;</span>
			</TD>
			</TR>
			<TR>
			<TD Background="&std_img_path;/parch3.jpg"><span
			  class="verdana sm black bold">&nbsp;Chant text&nbsp;</span>
			</TD>
			</TR>
			<TR>
			<TD Background="&std_img_path;/parch3.jpg"><span
			  class="verdana sm maroon"><b>&nbsp;Pitches </b>(optional)&nbsp;</span>
			</TD>
			</TR>
			<TR>
			<TD style="&tonal_bg;"><span
			  class="verdana sm blue bold">&nbsp;Tonal movement&nbsp;</span>
			</TD>
			</TR>
			</TBODY>
			</TABLE>
		</td><td>
			<!-- Key: -->
			<TABLE cellSpacing="0" cellPadding="1" border="0"
			  style="display:inline; margin-left:0px; margin-right:11px;">
			<CAPTION VAlign="top" Align="left">
			<span class="verdana med blue bold">Legend: <span
			  class="black">Tonal Movement</span></span>
			</CAPTION>
			<colgroup>
			  <col width="34"
			    style="&tonal_bg; margin-left:0px; margin-right:10px;" />
			  <col width="*" />
			</colgroup>
			<TBODY>
			<TR>
			<TD class="verdana sm maroon bold center">?</TD>
			<TD class="verdana sm black left">&nbsp;denotes that the tonal movement
			  from previous glyph is unknown.</TD>
			</TR>
			<TR>
			<TD class="verdana sm navy bold center">=</TD>
			<TD class="verdana sm black left">&nbsp;denotes tonal movement staying on
			  the same tone.</TD>
			</TR>
			<TR>
			<TD class="verdana sm navy bold center">-m3</TD>
			<TD class="verdana sm black left">&nbsp;denotes tonal movement down a minor
			  third; and so on.</TD>
			</TR>
			<TR>
			<TD class="verdana sm navy bold center">+(2)</TD>
			<TD class="verdana sm black left">&nbsp;denotes tonal movement up an
			  undifferentiated second; and so on.</TD>
			</TR>
			<TR>
			<TD class="verdana sm navy bold center">^</TD>
			<TD class="verdana sm black left">&nbsp;denotes ligation.</TD>
			</TR>
			<TR>
			<TD class="verdana sm green center"><b>[</b> <span
			  class="black">...</span> <b>]</b></TD>
			<TD class="verdana sm black left">&nbsp;denotes the beginning and end
			  of a neume.</TD>
			</TR>
			<TR>
			<TD class="verdana sm maroon center"><b>[</b> <span
			  class="black">...</span> <b>]</b></TD>
			<TD class="verdana sm black left">&nbsp;denotes the beginning and end
			  of a rubric or special symbol.</TD>
			</TR>
			<TR>
			<TD class="verdana sm red bold center">[?]</TD>
			<TD class="verdana sm black left">&nbsp;denotes an unrecognized character
			  in the transcription.</TD>
			</TR>
			</TBODY>
			</TABLE>
		</td></tr></tbody></table>
	</TD>
	</TR>

	<!-- REDISPLAY OPTIONS: -->
	<TR ID="Options" style="display:none;">
	<TD>
	<FORM name="redisplayForm">
		<TABLE CellSpacing="3" CellPadding="0" Border="0" Width="100%"
		  style="font-size:10px; font-family:&verdana;;">
		<TR VAlign="top">
		<!-- Column #1. zoom; margins; BG: -->
		<TD Align="center"><SPAN style="visibility:hidden;"><IMG Width="29" Height="29"
		  SRC="&std_img_path;/zoom.gif" HSpace="2" style="vertical-align:middle;"
		  alt="" /><span class="verdana med blue"><B>To rescale the visualization,<br />
		  enter an integer percentage<br />
		  in range of [50 - 200] %</B></span>&nbsp;
		  <SCRIPT type="text/javascript">
		  document.write('&lt;INPUT TYPE="text" NAME="magnification" ' +
		    'style="vertical-align:middle;" SIZE="3" MAXLENGTH="3" VALUE="' +
		    zoomValue + '" onkeypress="return noEnter()">');
		  </SCRIPT></SPAN>

		  <DIV style="position:relative; bottom: -11px;">
<!-- NOBR is non-compliant with standard: -->
		  <NOBR><span class="verdana med maroon">
		  <IMG Width="16" Height="16" SRC="&std_img_path;/margins_sm.gif"
		    HSpace="1" style="vertical-align:middle;" alt="" /><B>Margins</B></span>&nbsp;
		  <SCRIPT type="text/javascript">
		  document.write('&lt;INPUT TYPE="text" NAME="lmargin" ' +
		    'style="vertical-align:middle;" SIZE="3" MAXLENGTH="3" VALUE="' +
		    lmarginValue + '" onkeypress="return noEnter()">');
		  </SCRIPT>
		  &nbsp;Left&nbsp;
		  <SCRIPT type="text/javascript">
		  document.write('&lt;INPUT TYPE="text" NAME="rmargin" ' +
		    'style="vertical-align:middle;" SIZE="3" MAXLENGTH="3" VALUE="' +
		    rmarginValue + '" onkeypress="return noEnter()">');
		  </SCRIPT>&nbsp;RIGHT&nbsp;</NOBR>
<!--[end, NOBR]-->
		  <BR />
		  <span class="verdana med teal"><B>Background</B></span>
		  <SCRIPT type="text/javascript">
		  <!--  Nested single-quotes are escaped '\' to disambiguate the nesting.
			  Also, _see_ implementation note in the redrawDisplay() definition.
		  -->
		  document.write('&lt;INPUT type="RADIO" name="background" value="white" ' +
		    'style="vertical-align:middle;" onclick="bgValue=\'white\';" ');
		  if ('white' == bgValue) {
			document.write('CHECKED="true"');
		  }
		  document.write('>');
		  document.write('&lt;SPAN ' +
		    'style="background-color:#FFFFFF; color:inherit;">White&lt;/SPAN>&nbsp;');

		  document.write('&lt;INPUT type="RADIO" name="background" VALUE="parch" ' +
		    'style="vertical-align:middle;" onclick="bgValue=\'parch\';" ');
		  if ('parch' == bgValue) {
			document.write('CHECKED="true"');
		  }
		  document.write('>');
		  document.write('&lt;SPAN ' +
		    'style="background-color:#E6E3A0; color:inherit;">Parchment&lt;/SPAN>');
		  </SCRIPT>
		  </DIV>
		</TD>

		<!-- Column #2. title; notation-family selector: -->
		<TD Height="100%" Align="center">
			<TABLE CellPadding="0" CellSpacing="0" Width="100%">
			<TR VAlign="center">
			<TD BGColor="#E1DA52"><IMG Width="30" Height="30"
			  SRC="&std_img_path;/display_options.gif" HSpace="10" VSpace="1"
			  alt="" /></TD>
			<TD BGColor="#E1DA52" Align="left"><span class="verdana lg black"><B>Display
			  Options</B></span></TD>
			</TR>
			</TABLE>
		  <DIV style="position:relative; bottom: -9px;">
			<TABLE CellPadding="0" CellSpacing="0" Align="center">
			<TR VAlign="bottom">
			<TD Width="61"><IMG Width="53" Height="25"
			  SRC="&std_img_path;/chg_notation.jpg" HSpace="4" alt="" /></TD>
			<TD Align="left"><span class="verdana med green"><B>To view source in<br />
			  different notation:&nbsp;</B></span></TD>
			</TR>
			<TR>
			<TD ColSpan="2" Align="center">
			  <SELECT class="small" Name="notation_family" Size="3" Multiple="true">
			  <xsl:if test="$discipline='Western'">
<!--TO DO: put the following code into an iteration of an array? Maybe not, because the
 capability to display in different notation can vary among notations types.  -->
				<SCRIPT type="text/javascript">
				document.write('&lt;option value="native" ');
				if ('native' == notationValue) {
					document.write('SELECTED="true"');
				}
				document.write('>Native notation of the source&lt;/option>');

				document.write('&lt;option value="Aquitanian" ');
				if ('Aquitanian' == notationValue) {
					document.write('SELECTED="true"');
				}
				document.write('>Aquitanian&lt;/option>');

				document.write('&lt;option value="Sarum" ');
				if ('Sarum' == notationValue) {
					document.write('SELECTED="true"');
				}
				document.write('>Sarum&lt;/option>');

				document.write('&lt;option value="square" ');
				if ('square' == notationValue) {
					document.write('SELECTED="true"');
				}
				document.write('>Square-neume&lt;/option>');

				document.write('&lt;option value="St_Gall" ');
				if ('St_Gall' == notationValue) {
					document.write('SELECTED="true"');
				}
				document.write('>St. Gall&lt;/option>');
				</SCRIPT>
			  </xsl:if>
			  <xsl:if test="$discipline='Eastern'">
				<SCRIPT type="text/javascript">
				document.write('&lt;option value="native" ');
				if ('native' == notationValue) {
					document.write('SELECTED="true"');
				}
				document.write('>Native notation of the source&lt;/option>');

				document.write('&lt;option value="Middle_Byzantine" ');
				if ('Middle_Byzantine' == notationValue) {
					document.write('SELECTED="true"');
				}
				document.write('>Middle Byzantine&lt;/option>');

				document.write('&lt;option value="Post_Byzantine" ');
				if ('Post_Byzantine' == notationValue) {
					document.write('SELECTED="true"');
				}
				document.write('>Post Byzantine&lt;/option>');
				</SCRIPT>
			  </xsl:if>
			  </SELECT>
			</TD>
			</TR>
			</TABLE>
		  </DIV>
		</TD>

		<!-- Column #3. radio buttons; checkboxes; Redraw button: -->
		<TD Align="center">
		  <DIV Align="left"> <!-- align checkboxes -->

		  <!-- META-DATA: -->
		  <SCRIPT type="text/javascript">
		  <!--  Nested single-quotes are escaped '\' to disambiguate the nesting.
			  Also, _see_ implementation note in the redrawDisplay() definition.
		  -->
		  document.write('&lt;INPUT type="CHECKBOX" name="metadata" ' +
		    'value="no" onclick="readCheckBoxes();" ');
		  if ('yes' == metadataValue) {
			document.write('CHECKED');
		  }
		  document.write('>');
		  </SCRIPT>
		  <span class="verdana med brown">
		  <B><U>&nbsp;Suppress meta-data</U></B></span>&nbsp;
		  <IMG Width="36" Height="14" SRC="&std_img_path;/no_xml.gif"
		    style="vertical-align:middle;" alt="" /><BR />

		  <!-- PITCH/TONAL MOVEMENT: -->
		  <SCRIPT type="text/javascript">
		  <!--  Nested single-quotes are escaped '\' to disambiguate the nesting.
			  Also, see implementation note in the redrawDisplay() definition.
		  -->
		  document.write('&lt;INPUT type="CHECKBOX" name="pitchtone_mvmt" ' +
		    'value="no" onclick="readCheckBoxes();" ');
		  if ('no' == pitchtone_mvmtValue) {
			document.write('CHECKED="true"');
		  }
		  document.write('>');
		  </SCRIPT>
		  <span class="verdana med purple">
		  <B><U>&nbsp;Suppress pitch/tone</U></B></span>&nbsp;
		  <IMG Width="36" Height="14" SRC="&std_img_path;/no_pitch.gif"
		    style="vertical-align:middle;" alt="" /><BR />

		  <!-- NEW WINDOW: -->
<!-- NOBR is non-compliant with standard: -->
		  <NOBR><INPUT type="CHECKBOX" name="newWindow" value="yes"
		    onclick="readCheckBoxes();" />
		  <span class="verdana med navy">
		  <B><U>&nbsp;Open in new window</U></B></span>&nbsp;
		  <IMG Width="32" Height="31" SRC="&std_img_path;/new_window.gif"
		    style="vertical-align:middle;" alt="" /></NOBR><BR clear="left" />
<!--[end, NOBR]-->
		  </DIV>
		  <DIV style="position:relative; bottom: -10px;">
			<TABLE CellPadding="0" CellSpacing="0">
			<TR VAlign="middle"><TD RowSpan="2"><IMG Width="27" Height="27"
			  SRC="&std_img_path;/redisplay.gif" alt="" /></TD>
			<TD Width="6" RowSpan="2"><IMG Width="6" Height="0"
			  SRC="&std_img_path;/spacer1.gif" alt="" /></TD>
<!-- NOBR is non-compliant with standard: -->
			<TD Align="center"><NOBR><span class="verdana med maroon"><B>Click button
			  to redraw:</B></span></NOBR>
<!--[end, NOBR]-->
			</TD>
			</TR>
			<TR>
			<TD><INPUT TYPE="BUTTON" VALUE="Redraw visualization"
			  onclick="redrawDisplay(
			    document.redisplayForm.magnification.value,
			    document.redisplayForm.notation_family.value,
			    document.redisplayForm.lmargin.value,
			    document.redisplayForm.rmargin.value,
			    document.redisplayForm.userURL.value);" /></TD>
			</TR>
			</TABLE>
		  </DIV>
		</TD>
		</TR>

		<!-- Row 2. user-specified IMG filepath: -->
		<TR Align="bottom">
		<TD ColSpan="3" Align="center"><BR />
			<TABLE CellSpacing="0" CellPadding="0" style="font-size:10px;
			  font-family:&verdana;;">
			<TR VAlign="center">
			<TD><IMG Width="30" Height="31"
			  SRC="&std_img_path;/load_glyphs.gif" alt="" /></TD>
			<TD Width="3"><IMG Width="3" Height="0"
			  SRC="&std_img_path;/spacer1.gif" alt="" /></TD>
			<TD><B>To use custom glyph set, enter the image path&nbsp;<BR />
			  <I>http://<FONT Color="red">...</FONT>/images/</I><FONT Color="green">
			  OR&nbsp; </FONT><I>file:///<FONT Color="red">drive
			  letter</FONT>:/<FONT Color="red">...</FONT>/</I></B>
			</TD>
			<TD><SCRIPT type="text/javascript">
			  document.write('&lt;INPUT TYPE="text" NAME="userURL" SIZE="60" ' +
			    'MAXLENGTH="80" VALUE=\"' + userImgPathValue +
			    '\" onkeypress="return noEnter()">');
			  </SCRIPT></TD>
			</TR>
			</TABLE>
		</TD>
		</TR>
		</TABLE>
      </FORM>
	</TD>
	</TR>
	<!--[end, REDISPLAY OPTIONS]-->

	<SCRIPT type="text/javascript">
	document.write('&lt;/TABLE>');
	</SCRIPT>
	<BR clear="left" />
	</DIV>

	<!--  DIFFERENT NOTATION NOTICE (conditional display): -->
	<SCRIPT type="text/javascript">
	if ('yes' == metadataValue) {
		if ('native' != notationValue) {
			document.write('&lt;span class="verdana sm maroon bold">[Translation to ' +
			  current_notation + ' notation]&lt;/span>&lt;br>&lt;br>');
		}
	}
	</SCRIPT>


	<!--	***************************
		*** BEGIN TRANSCRIPTION ***
	-->
	<!-- OUTER TABLE: -->
	<SCRIPT type="text/javascript">
	openTranscriptionTable();
	</SCRIPT>
	<TR style="vertical-align:baseline;">
	<TD style="vertical-align:baseline;">

	<xsl:apply-templates select="//nxm:transcription"/>

	<!-- Close OUTER TABLE: -->
	</TD>
	</TR>
	<SCRIPT type="text/javascript">
	document.write('&lt;/TABLE>');
	</SCRIPT>
	<BR clear="left" />
	<!--[end, Transcription]-->

	<!-- Vertical retainer at end: -->
	<IMG Width="0" Height="24" SRC="&std_img_path;/spacer1.gif" alt="" />
	<!-- Closing: -->
	<BR clear="left" />

	<!-- Footer (conditional display): -->
	<SCRIPT type="text/javascript">
	if ('yes' == metadataValue) {
		document.write('&lt;CENTER>&lt;HR Width="87%">');
		document.write('&lt;FONT Size="4" Color="blue">&lt;B>= End, NEUMES ' +
		  'Transcription =&lt;/B>&lt;/FONT>&lt;BR>&lt;BR>');
		document.write('&lt;IMG Width="32" Height="32" SRC="&std_img_path;/help.gif" ' +
		  'HSpace="4" style="vertical-align:middle;" alt="Help">');
		document.write('&lt;INPUT TYPE="BUTTON" VALUE="Help" onclick="showHelpFile()">');
		document.write('&nbsp;&nbsp;&nbsp;&nbsp;');
		document.write('&lt;IMG Width="34" Height="31" HSpace="4" ' +
		  'SRC="&std_img_path;/show_errors.gif" style="vertical-align:middle;" ' +
		  'alt="Show errors">');
		document.write('&lt;INPUT TYPE="BUTTON" VALUE="List errors in visualization" ' +
		  'style="width:172px;" onclick="showErrList()">');
		document.write('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
		document.write('&lt;IMG Width="27" Height="32" HSpace="5" Border="1" ' +
		  'SRC="&std_img_path;/sourcecode.gif" style="vertical-align:middle;" ' +
		  'alt="Show sourcecode">');
		document.write('&lt;INPUT TYPE="BUTTON" VALUE="Show source code" ' +
		  'style="width:132px;" onclick="showSourceCode(\'' + filepathValue + '\')">');
		document.write('&nbsp;&nbsp;&nbsp;&nbsp;');
		document.write('&lt;IMG Width="34" Height="26" HSpace="3" ' +
		  'SRC="&std_img_path;/neumes_icon.gif" style="vertical-align:middle;" ' +
		  'alt="NEUMES Project homepage">');
		document.write('&lt;INPUT TYPE="BUTTON" VALUE="NEUMES homepage" ' +
		  'style="width:143px;" onclick="showHomepage()">');
		document.write('&lt;/CENTER>&lt;BR>');
	}
	document.write('&lt;/BODY>');
	</SCRIPT>
	</html>
</xsl:template>
<!--[end, Root Node template]-->


<!--	******************************
	**  GLOBAL LAYOUT Template  **

Gets the number of staff lines from *global_layout* and sets JavaScript variables.
[In document-order, this is the first element in *transcription_Type*.]
-->
<xsl:template match="//nxm:global_layout">

	<xsl:variable name="neumesSequence" select="text()"/>

	<!-- Staff Lines: -->
	<xsl:choose>
	<xsl:when test="contains($neumesSequence, '&staff_lines_6;')">
		<SCRIPT type="text/javascript">native_lines = 6;</SCRIPT>
	</xsl:when>
	<xsl:when test="contains($neumesSequence, '&staff_lines_5;')">
		<SCRIPT type="text/javascript">native_lines = 5;</SCRIPT>
	</xsl:when>
	<xsl:when test="contains($neumesSequence, '&staff_lines_4;')">
		<SCRIPT type="text/javascript">native_lines = 4;</SCRIPT>
	</xsl:when>
	<xsl:when test="contains($neumesSequence, '&staff_lines_3;')">
		<SCRIPT type="text/javascript">native_lines = 3;</SCRIPT>
	</xsl:when>
	<xsl:when test="contains($neumesSequence, '&staff_lines_2;')">
		<SCRIPT type="text/javascript">native_lines = 2;</SCRIPT>
	</xsl:when>
	<xsl:when test="contains($neumesSequence, '&staff_lines_1;')">
		<SCRIPT type="text/javascript">native_lines = 1;</SCRIPT>
	</xsl:when>
	<xsl:otherwise>
		<SCRIPT type="text/javascript">native_lines = 0;</SCRIPT>
	</xsl:otherwise>
	</xsl:choose>
	<SCRIPT type="text/javascript">setStaffLines();</SCRIPT>

	<!-- CONST Global Glyph Color: -->
	<xsl:choose>
	<xsl:when test="contains($neumesSequence, '&glyphs_color_red;')">
		<SCRIPT type="text/javascript">globalColorPath = '&red_subpath;';</SCRIPT>
	</xsl:when>
	<!-- Default = black: -->
	<xsl:otherwise>
		<SCRIPT type="text/javascript">globalColorPath = '';</SCRIPT>
	</xsl:otherwise>
	</xsl:choose>
	<!-- VAR Local Glyph Color: -->
	<SCRIPT type="text/javascript">imgColorPath=globalColorPath;</SCRIPT>

</xsl:template>
<!--[end, global_layout template]-->


<!--	**********************************
	**  PHYSICAL BOUNDARY Template  **
-->
<xsl:template match="//nxm:physical_boundary">
	<xsl:variable name="neumesSequence" select="text()"/>

	<!-- Begin physical_boundary: -->
	<xsl:variable name="description"
		select="self::node()/@description"/>

	<xsl:choose>
	<xsl:when test="$description='line_boundary'">
		<SCRIPT type="text/javascript">
		if (pitchtone_mvmtValue == "yes") {
			<!-- Close OUTER TABLE: -->
			document.write('&lt;/TD>&lt;/TR>&lt;/TABLE>&lt;BR clear="left">');
			<!-- Put linebreak in separate TABLE, and close: -->
			openTranscriptionTable();
			document.write('&lt;TD class="commentary">');
			document.write('&lt;FONT Color="navy">[line&nbsp;break]&lt;/FONT>');
			document.write('&lt;/TD>&lt;/TR>&lt;/TABLE>');
			document.write('&lt;BR clear="left">');
			openTranscriptionTable(); <!--Reopen OUTER TABLE-->
			document.write('&lt;TR>&lt;TD style="vertical-align:baseline">&nbsp;');
		}
		</SCRIPT>
	</xsl:when>
	<xsl:when test="$description='page_boundary'">
		<SCRIPT type="text/javascript">
		if (pitchtone_mvmtValue == "yes") {
			<!-- Close OUTER TABLE: -->
			document.write('&lt;/TD>&lt;/TR>&lt;/TABLE>&lt;BR clear="left">');
			<!-- Put pagebreak in separate TABLE, and close: -->
			openTranscriptionTable();
			document.write('&lt;TD class="commentary">');
			document.write('&lt;FONT Color="navy">[page&nbsp;break]&lt;/FONT>');
			document.write('&lt;/TD>&lt;/TR>&lt;/TABLE>');
			document.write('&lt;BR clear="left">');
			openTranscriptionTable(); <!--Reopen OUTER TABLE-->
			document.write('&lt;TR>&lt;TD style="vertical-align:baseline">&nbsp;');
		}
		</SCRIPT>
	</xsl:when>
	<xsl:otherwise>
		<FONT Color="red"><B>[?]</B></FONT>
	</xsl:otherwise>
	</xsl:choose>
</xsl:template>
<!--[end, physical_boundary template]-->


<!--	***********************
	**  RUBRIC Template  **

Template is for meta-data-delineated rubrics, sometimes appearing on the MS
inline with the chant text, but also including a few rubrics that appear with
the neumatic glyphs. Rubric tag has a "description" attribute.
Rubric commentary line is all one color.
-->
<xsl:template match="//nxm:rubric">
	<xsl:variable name="neumesSequence" select="text()"/>

	<TABLE class="neume" BORDER="0">

	<!-- GLYPHS Row: -->
	<SCRIPT type="text/javascript">
	openGlyphRow();
	</SCRIPT>
	<!-- Displays only glyphs inline with notation: -->
	<xsl:call-template name="ParseGlyphs">
		<xsl:with-param name="SequenceToParse" select="$neumesSequence"/>
	</xsl:call-template>
	<SCRIPT type="text/javascript">document.write('&lt;/TR>');</SCRIPT>

	<!-- INTONED TEXT Row: -->
	<TR>
	<!-- Display only rubric text plus glyphs that go inline w/chant text: -->
	<TD class="intone">
	<xsl:call-template name="ParseRubric">
		<xsl:with-param name="SequenceToParse" select="$neumesSequence"/>
		<xsl:with-param name="insideTag" select="'no'"/> <!--if Other tag is embedded-->
	</xsl:call-template>
	&nbsp;</TD> <!--retainer in case empty-->
	</TR>

	<!-- PITCH Row (empty): -->
	<SCRIPT type="text/javascript">
	if ('no' == pitchtone_mvmtValue) {
		document.write('&lt;TR style="display:none;">');
	} else {
		document.write('&lt;TR class="pitches">');
	}
	</SCRIPT>
	<TD class="pitches">&nbsp;</TD>  <!-- spacer necessary to prevent collapse of row -->
	<SCRIPT type="text/javascript">
	document.write('&lt;/TR>');
	</SCRIPT>

	<!-- TONAL MOVEMENT Row: -->
	<SCRIPT type="text/javascript">
	if ('no' == pitchtone_mvmtValue) {
		document.write('&lt;TR style="display:none;">');
	} else {
		document.write('&lt;TR class="commentary">');
	}
	</SCRIPT>
	<TD class="commentary"><FONT color="maroon">
<!-- NOBR is non-compliant with standard: -->
	<xsl:text disable-output-escaping="yes">&lt;NOBR>&start_rubric;</xsl:text>
	<xsl:if test="self::node()[@description]">
		<!-- Escape double-quotes and apostrophes: -->
		<xsl:variable name="userComment" select="self::node()/@description"/>
		<xsl:variable name="noQuot">
			<xsl:call-template name="EscQuot">
				<xsl:with-param name="passString" select="$userComment"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="noAposQuot">
			<xsl:call-template name="EscApos">
				<xsl:with-param name="passString" select="$noQuot"/>
			</xsl:call-template>
		</xsl:variable>
		<xsl:text disable-output-escaping="yes">&lt;A HRef="" class="rubric"
			onClick="noop=pop('</xsl:text>
		<xsl:value-of select="$noAposQuot"/>
		<xsl:text disable-output-escaping="yes">'); return false;">&cm;</xsl:text>
	</xsl:if>
	<!-- Commentary: -->
	<xsl:choose>
		<!-- Western sources: -->
		<xsl:when test="contains($neumesSequence, '&doh_clef;')"> doh clef</xsl:when>
		<xsl:when test="contains($neumesSequence, '&fah_clef;')"> fah clef</xsl:when>
		<xsl:when test="contains($neumesSequence, '&custos;')"> custos</xsl:when>
		<xsl:when test="contains($neumesSequence, '&equaliter;')"> equaliter</xsl:when>
		<xsl:when test="contains($neumesSequence, '&ut_supra;')"> ut supra</xsl:when>
		<xsl:when test="contains($neumesSequence, '&antiphon;')"> antiphon</xsl:when>
		<xsl:when test="contains($neumesSequence, '&verse;')"> verse</xsl:when>
		<xsl:when test="contains($neumesSequence, '&response;')"> response</xsl:when>
		<xsl:when test="contains($neumesSequence, '&ij;')"> ij.</xsl:when>
		<xsl:when test="contains($neumesSequence, '&iij;')"> iij.</xsl:when>
		<!-- Eastern sources: -->
		<xsl:when
		  test="contains($neumesSequence, '&martyria_deuteros;')"> martyr</xsl:when>
		<xsl:when
		  test="contains($neumesSequence, '&martyria_plagios_deuteros;')">
		  martyr</xsl:when>
		<xsl:when
		  test="contains($neumesSequence, '&fanerosis_tetrafonias;')"> martyr</xsl:when>
<!-- $$ continue ... -->
		<!-- Generic Rubric: -->
		<xsl:otherwise>rubric</xsl:otherwise>
	</xsl:choose>
	<!-- End comment if open: -->
	<xsl:if test="self::node()[@description]">
		<xsl:text disable-output-escaping="yes">&lt;/A></xsl:text>
	</xsl:if>
	<xsl:text disable-output-escaping="yes">&lt;/NOBR>&end_rubric;</xsl:text></FONT></TD>
<!--[end, NOBR]-->
	<SCRIPT type="text/javascript">
	document.write('&lt;/TR>');
	</SCRIPT>
	</TABLE>
</xsl:template>
<!--[end, rubric template]-->


<!--	********************
	**  PARSE RUBRIC  **

Recursive template parses a rubric character-by-character; outputs any (non-PUA) text
plus images that belong inline w/chant text. Skips any tags that are embedded within Rubric.
-->
<xsl:template name="ParseRubric">
	<xsl:param name="SequenceToParse"/>
	<xsl:param name="insideTag"/>

	<xsl:variable name="FirstChar" select="substring($SequenceToParse, 1, 1)"/>

	<xsl:choose>
	<xsl:when test="$FirstChar=''"/> <!--Base case, stop recursion.-->
	<xsl:when test="$FirstChar='&lt;'"> <!--Entering an Other tag-->
		<xsl:call-template name="ParseRubric">
			<xsl:with-param name="SequenceToParse"
				select="substring($SequenceToParse, 2)"/>
			<xsl:with-param name="insideTag" select="'yes'"/>
		</xsl:call-template>
	</xsl:when>
	<xsl:when test="$FirstChar='>'"> <!--Exiting an Other tag-->
		<xsl:call-template name="ParseRubric">
			<xsl:with-param name="SequenceToParse"
				select="substring($SequenceToParse, 2)"/>
			<xsl:with-param name="insideTag" select="'no'"/>
		</xsl:call-template>
	</xsl:when>
	<xsl:otherwise>
		<xsl:choose>
		<xsl:when test="$insideTag='yes'"/> <!--Inside an Other tag: skip-->
		<xsl:when test="$FirstChar='&STA;'"/>
		<xsl:when test="$FirstChar='&END;'"/>
		<!-- Clef signs, skip: -->
		<xsl:when test="contains('&ClefSigns;', $FirstChar)"/>
		<xsl:when test="contains('&ClefPositions;', $FirstChar)"/>
		<!-- Cases of particular glyphs that are not inline w/chant text, skip: -->
		<xsl:when test="$FirstChar='&custos;'"/>
		<xsl:when test="$FirstChar='&equaliter;'"/>
		<xsl:when test="$FirstChar='&ut_supra;'"/>
		<!-- $$ skip Martyriai [text in martyria?]: -->
		<xsl:when test="contains('&Martyriai;', $FirstChar)"/>
		<!-- SubstituteStyle, LocalColor, Pitch, TonalMovement, or CF in Rubric: -->
		<xsl:when test="contains('&SubstituteStyles;', $FirstChar)"/>
		<xsl:when test="contains('&LocalInkColors;', $FirstChar)"/>
		<xsl:when test="contains('&Pitches;', $FirstChar)"/>
		<xsl:when test="contains('&TonalMovements;', $FirstChar)"/>
		<xsl:when test="contains('&CertaintyFactors;', $FirstChar)"/>
		<xsl:when test="$FirstChar='&verse;'">
			<IMG SRC="&std_img_path;/shared/verse_1.gif"
			  style="vertical-align:baseline;" onError="imgErr('verse_1.gif');"
			  alt="Verse" />
		</xsl:when>
<!-- Other Rubric Glyphs go here. -->
		<xsl:otherwise>
			<!-- Check for out-of-range char: -->
			<SCRIPT type="text/javascript">
			if ('<xsl:value-of select="$FirstChar"/>' >= '&PUA_floor;') {
				document.write('&lt;span class="verdana med red">&lt;B>[?]&lt;/B>&lt;/span>');
			} else {
				document.write('<xsl:value-of select="$FirstChar"/>');
			}
			</SCRIPT>			
		</xsl:otherwise>
		</xsl:choose>
		<xsl:call-template name="ParseRubric"> <!--Recurse-->
			<xsl:with-param name="SequenceToParse"
				select="substring($SequenceToParse, 2)"/>
			<xsl:with-param name="insideTag" select="$insideTag"/>
		</xsl:call-template>
	</xsl:otherwise>
	</xsl:choose>
</xsl:template>
<!--[end, Parse Rubric]-->


<!--	********************************
	**  NEUMED_SYLLABLE Template  **

Template dispatches the creation of one table for each Neume.
It assembles the chant text with a neumatic symbol for the first table.
-->
<xsl:template match="//nxm:neumed_syllable">
	<xsl:variable name="included_text" select="child::nxm:syllable[1]/text()"/>
	<xsl:for-each select="child::nxm:neume[1]">
		<xsl:call-template name="neume_table">
			<xsl:with-param name="intoned_text" select="$included_text"/>
		</xsl:call-template>
	</xsl:for-each>
	<xsl:for-each select="child::nxm:neume[position()>1]">
		<xsl:call-template name="neume_table">
			<xsl:with-param name="intoned_text"></xsl:with-param> <!--no param-->
		</xsl:call-template>
	</xsl:for-each>
</xsl:template>


<!--	*******************
	**  NEUME TABLE  **

Template controls the placement of items in rows of a table for one Neume.
"intoned_text" contains chant text on first neume; it is empty in subsequent
calls.
-->
<xsl:template name="neume_table">
	<xsl:param name="intoned_text"/>
<!--xxx Testing: BORDER="1" bordercolor="#CDCDCD" -->
	<xsl:variable name="neumesSequence" select="text()"/>
	<TABLE class="neume">
	<!-- GLYPHS Row: -->
	<SCRIPT type="text/javascript">openGlyphRow();</SCRIPT>
	<xsl:call-template name="ParseGlyphs">
		<xsl:with-param name="SequenceToParse" select="$neumesSequence"/>
	</xsl:call-template>
	<SCRIPT type="text/javascript">document.write('&lt;/TR>');</SCRIPT>

	<!-- INTONED TEXT Row: -->
	<TR>
	<!-- Retainer in case empty: -->
	<TD class="intone"><xsl:value-of select="$intoned_text"/>&nbsp;</TD>
	</TR>

	<!-- PITCH Row: -->
	<SCRIPT type="text/javascript">
	if ('no' == pitchtone_mvmtValue) {
		document.write('&lt;TR style="display:none;">');
	} else {
		document.write('&lt;TR class="pitches">');
	}
	</SCRIPT>
	<xsl:if test="$pitched='true'">
		<!-- (No need to pre-open TD) -->
		<xsl:call-template name="ParsePitches">
			<xsl:with-param name="SequenceToParse"
				select="substring($neumesSequence, 1)"/>
		</xsl:call-template>
	</xsl:if>
	<SCRIPT type="text/javascript">document.write('&lt;/TR>');</SCRIPT>

	<!-- TONAL MOVEMENT Row: -->
	<SCRIPT type="text/javascript">
	if ('no' == pitchtone_mvmtValue) {
		document.write('&lt;TR style="display:none;">');
	} else {
		document.write('&lt;TR class="commentary">');
	}
	</SCRIPT>
	<TD class="commentary">
	<FONT Color="green"><xsl:text
		disable-output-escaping="yes">&lt;NOBR>&start_neume;</xsl:text>
	<!-- Allow one comment in this position: -->
	<xsl:for-each select="child::nxm:comment[1]">
		<xsl:text disable-output-escaping="yes">&lt;A HRef=""
			onClick="noop=pop('</xsl:text>
		<xsl:value-of select="self::node()/@content"/>
		<xsl:text disable-output-escaping="yes">'); return false;">&cm;</xsl:text>
	</xsl:for-each>
	</FONT><SPAN style="color:navy;">
	<xsl:call-template name="ParseTonalMovement"> <!--write the Tonal Movements-->
		<xsl:with-param name="SequenceToParse" select="substring($neumesSequence, 1)"/>
		<!-- Notify template that TD is open: -->
		<xsl:with-param name="TD_opened" select="'yes'"/>
	</xsl:call-template>
	</SPAN>
	<!-- End comment if open: -->
	<xsl:for-each select="child::nxm:comment[1]">
		<xsl:text disable-output-escaping="yes">&lt;/A></xsl:text>
	</xsl:for-each>
	<!-- Close TD [no space]: -->
	<FONT Color="green"><xsl:text
		disable-output-escaping="yes">&end_neume;&lt;/NOBR></xsl:text></FONT></TD>
	<SCRIPT type="text/javascript">document.write('&lt;/TR>');</SCRIPT>
	</TABLE>
</xsl:template>


<!--	********************
	**  PARSE GLYPHS  **

Displays only glyphs (rubric or neume) that are inline with the chant notation.
For each pair of characters "&STA;" "&END;" (which delimit one neumatic symbol,
be it simple or compound), instantiate a new <td> Element in this table row.
Recursive template parses a string character-by-character for NEUMES characters.
The glyphs are displayed in the TOP ROW. First caller does not open or close TD.
-->
<xsl:template name="ParseGlyphs">
	<xsl:param name="SequenceToParse"/>

	<xsl:variable name="FirstChar" select="substring($SequenceToParse, 1, 1)"/>
	<xsl:variable name="LineLessOne" select="substring($SequenceToParse, 2)"/>

	<xsl:if test="$FirstChar != ''"> <!--Stop recursion at end-of-string-->
		<!-- Only the first xsl:when that tests true is instantiated -->
		<xsl:choose>
		<!-- Neumatic Symbol Delimeters: -->
		<xsl:when test="$FirstChar='&STA;'">
			<xsl:text disable-output-escaping="yes">
<!--xxx Testing
In NeumesXML_xsl.css: bottom works, glyph offset measured from bottom [top puts
 ALL glyphs at top line]. vertical-align: bottom;
  border=1 bordercolor="red"
-->
				&lt;TD class="glyph" Align="left">
			</xsl:text>
		</xsl:when>
		<xsl:when test="$FirstChar='&END;'">
			<xsl:text disable-output-escaping="yes">&lt;/TD></xsl:text>
		</xsl:when>
		<!-- Compound Neume Forms Layout: -->
		<xsl:when test="$FirstChar='&STA_compose;'">
			<xsl:text disable-output-escaping="yes">
			  &lt;TABLE class="compositeNeume" CellSpacing="0"
			  CellPadding="0">&lt;TR>&lt;TD class="stackedGlyph">
			</xsl:text>
		</xsl:when>
		<xsl:when test="$FirstChar='&subordinate;'">
			<xsl:text disable-output-escaping="yes">
			  &lt;/TD>&lt;/TR>&lt;TR>&lt;TD class="stackedGlyph">
			</xsl:text>
		</xsl:when>
		<xsl:when test="$FirstChar='&END_compose;'">
			<xsl:text disable-output-escaping="yes">
			  &lt;/TD>&lt;/TR>&lt;/TABLE>
			</xsl:text>
		</xsl:when>
		<!-- Displayable Western glyphs: -->
		<xsl:when test="$discipline='Western'">
			<!-- Enumerated in probable-frequency order -->
			<xsl:choose>
			<xsl:when test="contains('&NeumaticSymbolsWest;', $FirstChar)
				or contains('&CompatibilityCharsWest;', $FirstChar)
				or contains('&NeumeAdjunctSymbolsWest;', $FirstChar)
				or contains('&NeumeRubricsHeightedWest;', $FirstChar)
				or contains('&NeumeRubricsUnheightedWest;', $FirstChar)
				or contains('&ClefSigns;', $FirstChar)">
					<xsl:call-template name="VisualizeGlyph">
						<xsl:with-param name="CharToShow" select="$FirstChar"/>
						<xsl:with-param name="LineRemainder"
						  select="$LineLessOne"/>
					</xsl:call-template>
			</xsl:when>
			<!-- noop -->
			</xsl:choose>
		</xsl:when>
		<!-- Displayable Eastern glyphs: -->
		<xsl:when test="$discipline='Eastern'">
			<!-- Enumerated in probable-frequency order -->
			<xsl:choose>
			<xsl:when test="contains('&NeumaticSymbolsEast;', $FirstChar)
				or contains('&QualifierGlyphsEast;', $FirstChar)
				or contains('&CompatibilityCharsEast;', $FirstChar)
				or contains('&GreatSigns;', $FirstChar)
				or contains('&Martyriai;', $FirstChar)">
					<xsl:call-template name="VisualizeGlyph">
						<xsl:with-param name="CharToShow" select="$FirstChar"/>
						<xsl:with-param name="LineRemainder"
						  select="$LineLessOne"/>
					</xsl:call-template>
			</xsl:when>
			<!-- noop otherwise -->
			</xsl:choose>
		</xsl:when>
		</xsl:choose>
		<!-- Skip all other characters. Recurse in any case: -->
		<xsl:call-template name="ParseGlyphs"> <!--Recurse-->
			<xsl:with-param name="SequenceToParse" select="$LineLessOne"/>
		</xsl:call-template>
	</xsl:if> <!--end, if not end-of-string; stop recursion -->
</xsl:template>
<!--[end, Parse Glyphs]-->


<!--	*********************
	**  PARSE PITCHES  **

Recursive template parses a NEUMES sequence character-by-character.
First caller does not open or close TD.
-->
<xsl:template name="ParsePitches">
	<xsl:param name="SequenceToParse"/>

	<xsl:variable name="FirstChar" select="substring($SequenceToParse, 1, 1)"/>
	<xsl:variable name="SecondChar" select="substring($SequenceToParse, 2, 1)"/>
	<xsl:variable name="LineLessOne" select="substring($SequenceToParse, 2)"/>

	<xsl:if test="$FirstChar != ''"> <!--Stop recursion if end-of-string-->
		<xsl:choose>
		<xsl:when test="$FirstChar='&STA;'">
			<xsl:text disable-output-escaping="yes">
				&lt;TD class="pitches">&lt;SPAN style="color:maroon;">&lt;SUB>
					&lt;/SUB>
			</xsl:text>
		</xsl:when>
		<xsl:when test="$FirstChar='&END;'">
			<xsl:text disable-output-escaping="yes">&lt;/SPAN>&lt;SUB>
				&lt;/SUB>&lt;/TD></xsl:text>
		</xsl:when>
		<xsl:when test="$FirstChar='&ton_ut;'">ut </xsl:when>
		<xsl:when test="$FirstChar='&ton_re;'">re </xsl:when>
		<xsl:when test="$FirstChar='&ton_mi;'">mi </xsl:when>
		<xsl:when test="$FirstChar='&ton_fa;'">fa </xsl:when>
		<xsl:when test="$FirstChar='&ton_sol;'">sol </xsl:when>
		<xsl:when test="$FirstChar='&ton_la;'">la </xsl:when>
		<xsl:when test="$FirstChar='&ton_si;'">si </xsl:when>

		<xsl:when test="$FirstChar='&ton_GG;'">GG </xsl:when>
		<xsl:when test="$FirstChar='&ton_A;'">A </xsl:when>
		<xsl:when test="$FirstChar='&ton_B;'">B </xsl:when>
		<xsl:when test="$FirstChar='&ton_H;'">H </xsl:when>
		<xsl:when test="$FirstChar='&ton_C;'">C </xsl:when>
		<xsl:when test="$FirstChar='&ton_D;'">D </xsl:when>
		<xsl:when test="$FirstChar='&ton_E;'">E </xsl:when>
		<xsl:when test="$FirstChar='&ton_F;'">F </xsl:when>
		<xsl:when test="$FirstChar='&ton_G;'">G </xsl:when>
		<xsl:when test="$FirstChar='&ton_a;'">a </xsl:when>
		<xsl:when test="$FirstChar='&ton_b;'">b </xsl:when>
		<xsl:when test="$FirstChar='&ton_h;'">h </xsl:when>
		<xsl:when test="$FirstChar='&ton_c;'">c </xsl:when>
		<xsl:when test="$FirstChar='&ton_d;'">d </xsl:when>
		<xsl:when test="$FirstChar='&ton_e;'">e </xsl:when>
		<xsl:when test="$FirstChar='&ton_f;'">f </xsl:when>
		<xsl:when test="$FirstChar='&ton_g;'">g </xsl:when>
		<xsl:when test="$FirstChar='&ton_aa;'">aa </xsl:when>
		<xsl:when test="$FirstChar='&ton_bb;'">bb </xsl:when>
		<xsl:when test="$FirstChar='&ton_hh;'">hh </xsl:when>
		<xsl:when test="$FirstChar='&ton_cc;'">cc </xsl:when>
		<xsl:when test="$FirstChar='&ton_dd;'">dd </xsl:when>
		<xsl:when test="$FirstChar='&ton_ee;'">ee </xsl:when>
		<xsl:when test="$FirstChar='&ton_ff;'">ff </xsl:when>
		<xsl:when test="$FirstChar='&ton_gg;'">gg </xsl:when>
		</xsl:choose>
		<xsl:call-template name="ParsePitches"> <!--Recurse-->
			<xsl:with-param name="SequenceToParse" select="$LineLessOne"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>


<!--	****************************
	**  PARSE TONAL MOVEMENT  **

Recursive template parses a NEUMES sequence character-by-character and outputs
Tonal Movement line of display.
First caller opens and closes TD.
-->
<xsl:template name="ParseTonalMovement">
	<xsl:param name="SequenceToParse"/>
	<xsl:param name="TD_opened"/>

	<xsl:variable name="FirstChar" select="substring($SequenceToParse, 1, 1)"/>
	<xsl:variable name="SecondChar" select="substring($SequenceToParse, 2, 1)"/>
	<xsl:variable name="LineLessOne" select="substring($SequenceToParse, 2)"/>
	<xsl:choose>
		<xsl:when test="$FirstChar=''"/> <!--Stop recursion if end-of-string-->
		<xsl:when test="$FirstChar='&STA;'">
			<xsl:if test="$TD_opened='no'">
				<!-- NO SPACE: -->
				<xsl:text disable-output-escaping="yes">&lt;TD
				  class="commentary">&lt;SPAN style="color:navy;"></xsl:text>
			</xsl:if>
			<xsl:call-template name="ParseTonalMovement">
				<xsl:with-param name="SequenceToParse" select="$LineLessOne"/>
				<xsl:with-param name="TD_opened" select="'yes'"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:when test="$FirstChar='&END;'">
			<xsl:choose>
			<!-- First caller will close TD if this is end of neume: -->
			<xsl:when test="$SecondChar=''">
				<xsl:call-template name="ParseTonalMovement">
					<xsl:with-param name="SequenceToParse" select="$LineLessOne"/>
					<xsl:with-param name="TD_opened" select="'yes'"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:text
					disable-output-escaping="yes">&lt;/SPAN>&lt;/TD></xsl:text>
				<xsl:call-template name="ParseTonalMovement">
					<xsl:with-param name="SequenceToParse" select="$LineLessOne"/>
					<xsl:with-param name="TD_opened" select="'no'"/>
				</xsl:call-template>
			</xsl:otherwise>
			</xsl:choose>
		</xsl:when>
		<xsl:otherwise>
			<xsl:choose>
			<xsl:when test="$FirstChar='&LIG;'">&ligation;</xsl:when>
			<xsl:when test="$FirstChar='&no_tone;'">&no_tone_mark;</xsl:when>
			<xsl:when test="$FirstChar='&no_preced;'">&no_preced_tone;</xsl:when>
			<xsl:when test="$FirstChar='&UNK;'">&mv_unk;</xsl:when>
			<xsl:when test="$FirstChar='&EQ;'">&mv_eq;</xsl:when>
			<!-- Up: -->
			<xsl:when test="$FirstChar='&up;'">&mv_up;</xsl:when>
			<xsl:when test="$FirstChar='&up_little;'">&mv_up;lit</xsl:when>
			<xsl:when test="$FirstChar='&up_lot;'">&mv_up;lot</xsl:when>
			<xsl:when test="$FirstChar='&up_undiff2;'">&mv_up;(2)</xsl:when>
			<xsl:when test="$FirstChar='&up_m2;'">&mv_up;m2</xsl:when>
			<xsl:when test="$FirstChar='&up_M2;'">&mv_up;M2</xsl:when>
			<xsl:when test="$FirstChar='&up_undiff3;'">&mv_up;(3)</xsl:when>
			<xsl:when test="$FirstChar='&up_m3;'">&mv_up;m3</xsl:when>
			<xsl:when test="$FirstChar='&up_M3;'">&mv_up;M3</xsl:when>
			<xsl:when test="$FirstChar='&up_4;'">&mv_up;4</xsl:when>
			<xsl:when test="$FirstChar='&up_aug4;'">&mv_up;aug4</xsl:when>
			<xsl:when test="$FirstChar='&up_dim5;'">&mv_up;dim5</xsl:when>
			<xsl:when test="$FirstChar='&up_5;'">&mv_up;5</xsl:when>
			<xsl:when test="$FirstChar='&up_undiff6;'">&mv_up;(6)</xsl:when>
			<xsl:when test="$FirstChar='&up_m6;'">&mv_up;m6</xsl:when>
			<xsl:when test="$FirstChar='&up_M6;'">&mv_up;M6</xsl:when>
			<xsl:when test="$FirstChar='&up_undiff7;'">&mv_up;(7)</xsl:when>
			<xsl:when test="$FirstChar='&up_m7;'">&mv_up;m7</xsl:when>
			<xsl:when test="$FirstChar='&up_M7;'">&mv_up;M7</xsl:when>
			<xsl:when test="$FirstChar='&up_8;'">&mv_up;8</xsl:when>
			<xsl:when test="$FirstChar='&up_undiff9;'">&mv_up;(9)</xsl:when>
			<!-- Down: -->
			<xsl:when test="$FirstChar='&dn;'">&mv_dn;</xsl:when>
			<xsl:when test="$FirstChar='&dn_little;'">&mv_dn;lit</xsl:when>
			<xsl:when test="$FirstChar='&dn_lot;'">&mv_dn;lot</xsl:when>
			<xsl:when test="$FirstChar='&dn_undiff2;'">&mv_dn;(2)</xsl:when>
			<xsl:when test="$FirstChar='&dn_m2;'">&mv_dn;m2</xsl:when>
			<xsl:when test="$FirstChar='&dn_M2;'">&mv_dn;M2</xsl:when>
			<xsl:when test="$FirstChar='&dn_undiff3;'">&mv_dn;(3)</xsl:when>
			<xsl:when test="$FirstChar='&dn_m3;'">&mv_dn;m3</xsl:when>
			<xsl:when test="$FirstChar='&dn_M3;'">&mv_dn;M3</xsl:when>
			<xsl:when test="$FirstChar='&dn_4;'">&mv_dn;4</xsl:when>
			<xsl:when test="$FirstChar='&dn_aug4;'">&mv_dn;aug4</xsl:when>
			<xsl:when test="$FirstChar='&dn_dim5;'">&mv_dn;dim5</xsl:when>
			<xsl:when test="$FirstChar='&dn_5;'">&mv_dn;5</xsl:when>
			<xsl:when test="$FirstChar='&dn_undiff6;'">&mv_dn;(6)</xsl:when>
			<xsl:when test="$FirstChar='&dn_m6;'">&mv_dn;m6</xsl:when>
			<xsl:when test="$FirstChar='&dn_M6;'">&mv_dn;M6</xsl:when>
			<xsl:when test="$FirstChar='&dn_undiff7;'">&mv_dn;(7)</xsl:when>
			<xsl:when test="$FirstChar='&dn_m7;'">&mv_dn;m7</xsl:when>
			<xsl:when test="$FirstChar='&dn_M7;'">&mv_dn;M7</xsl:when>
			<xsl:when test="$FirstChar='&dn_8;'">&mv_dn;8</xsl:when>
			<xsl:when test="$FirstChar='&dn_undiff9;'">&mv_dn;9</xsl:when>
			</xsl:choose>
			<xsl:call-template name="ParseTonalMovement"> <!--Recurse-->
				<xsl:with-param name="SequenceToParse" select="$LineLessOne"/>
				<xsl:with-param name="TD_opened" select="$TD_opened"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>
<!--[end, Parse Tonal Mvmt]-->


<!--	***********************
	**  VISUALIZE GLYPH  **

Should be called only when *CharToShow* is a rubrical glyph or a neumatic
glyph. Template calls MapGlyphImage() to get the standard .gif filename
for this NEUMES character, then dispatches display by calling Glyph().
Also sets the color path temporarily for this glyph.

The first three characters after this character are examined for Substitute
Style or Qualifier in order to pass SubStyle parameter to MapGlyphImage().
(Some Qualifiers, such as '&quilisma;', affect the choice of glyph image;
there is no harm in passing Qualifier, because MapGlyphImage() defaults
to the standard .gif filename.)

Sequence of Characters in a neumatic glyph:
	glyph character
	optional CF
	optional Substitute Style
	optional Local Color
	one-or-more optional Qualifiers, plus CFs
Followed by Neume a descriptor list:
	optional pitch, plus CF
	tonal movement, plus CF
	optional LIGation
The Position specifier of a clef is considered as a Qualifier of the clef.
Errors: Display inline red a '?' if unrecognized PUA char, or char as-is if non-PUA.
-->
<xsl:template name="VisualizeGlyph">
	<xsl:param name="CharToShow"/>
	<xsl:param name="LineRemainder"/>

	<xsl:variable name="SecondChar" select="substring($LineRemainder, 1, 1)"/>
	<xsl:variable name="ThirdChar" select="substring($LineRemainder, 2, 1)"/>
	<xsl:variable name="FourthChar" select="substring($LineRemainder, 3, 1)"/>

	<xsl:variable name="CF">
		<xsl:choose>
			<xsl:when test="contains('&CertaintyFactors;', $SecondChar)">
				<xsl:value-of select="$SecondChar"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="'&objReplace;'"/>
			</xsl:otherwise>
			</xsl:choose>
	</xsl:variable>

	<xsl:variable name="SubStyle">
		<!-- ordered choose, preferring SubstituteStyles over Qualifiers: -->
		<xsl:choose>
		<xsl:when test="contains('&SubstituteStyles;', $SecondChar)
		  or contains('&QualifiersWest;', $SecondChar)
		  or contains('&QualifierGlyphsEast;', $SecondChar)">
			<xsl:value-of select="$SecondChar"/>
		</xsl:when>
		<xsl:when test="contains('&SubstituteStyles;', $ThirdChar)
		  or contains('&QualifiersWest;', $ThirdChar)
		  or contains('&QualifierGlyphsEast;', $ThirdChar)">
			<xsl:value-of select="$ThirdChar"/>
		</xsl:when>
		<xsl:when test="contains('&SubstituteStyles;', $FourthChar)
		  or contains('&QualifiersWest;', $FourthChar)
		  or contains('&QualifierGlyphsEast;', $FourthChar)">
			<xsl:value-of select="$FourthChar"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="'&objReplace;'"/>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

	<xsl:variable name="LocalColor">
		<xsl:choose>
		<xsl:when test="contains('&LocalInkColors;', $SecondChar)">
			<xsl:value-of select="$SecondChar"/>
		</xsl:when>
		<xsl:when test="contains('&LocalInkColors;', $ThirdChar)">
			<xsl:value-of select="$ThirdChar"/>
		</xsl:when>
<!-- XXX buggy, composed symbols
		<xsl:when test="contains('&CertaintyFactors;', $SecondChar)
		  and contains('&LocalInkColors;', $FourthChar))">
			<xsl:value-of select="$FourthChar"/>
		</xsl:when>
-->
		<xsl:otherwise>
			<xsl:value-of select="'&objReplace;'"/>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

	<xsl:variable name="ImgName">
		<xsl:call-template name="MapGlyphImage">
			<xsl:with-param name="CharToShow" select="$CharToShow"/>
			<xsl:with-param name="SubStyle" select="$SubStyle"/>
		</xsl:call-template>
	</xsl:variable>

	<xsl:choose>
	<!-- IF ERROR, HANDLE IT: -->
	<xsl:when test="$ImgName='&objReplace;'">
		<SCRIPT type="text/javascript">
		var CharToShow = '<xsl:value-of select="$CharToShow"/>';
		</SCRIPT>
		<xsl:text disable-output-escaping="yes">
		&lt;SCRIPT type="text/javascript">
		document.write('&lt;FONT Color="red">&lt;B>[');
		<!-- Error if char is in Private Use Area but no image known: -->
		if ((CharToShow >= '&NEUMES_floor;') &amp;&amp;
			(CharToShow &lt;= '&NEUMES_ceiling;')) {
			document.write('?');
		} else {
			<!-- Non-PUA case should never happen:  -->
			document.write(CharToShow);
		}
		document.write(']&lt;/B>&lt;/FONT>');
		&lt;/SCRIPT>
		</xsl:text>
	</xsl:when>
	<!-- OTHERWISE DISPATCH: -->
	<xsl:otherwise>
		<!-- Change local color before dispatch: -->
		<xsl:choose>
		<xsl:when test="contains($LocalColor, '&local_color_red;')">
			<SCRIPT type="text/javascript">imgColorPath= '&red_subpath;';</SCRIPT>
		</xsl:when>
		<xsl:when test="contains($LocalColor, '&local_color_black;')">
			<SCRIPT type="text/javascript">imgColorPath= '';</SCRIPT>
		</xsl:when>
		</xsl:choose>
		<!-- Dispatch: -->
 		<xsl:call-template name="Glyph">
			<xsl:with-param name="CharToShow" select="$CharToShow"/>
			<xsl:with-param name="Output" select="$ImgName"/>
			<xsl:with-param name="LineRemainder" select="$LineRemainder"/>
			<xsl:with-param name="CF" select="$CF"/>
		</xsl:call-template>
		<!-- Restore, local color <- global color iff changed [economize JavaScript]: -->
		<xsl:if test="$LocalColor != '&objReplace;'">
			<SCRIPT type="text/javascript">imgColorPath=globalColorPath;</SCRIPT>
		</xsl:if>
	</xsl:otherwise>
	</xsl:choose>
</xsl:template>
<!--[end, Visualize Glyph]-->


<!--	*************
	**  GLYPH  **

Template computes glyph Height based on Tonal Movement.
Each tone in a multi-tonal glyph has a Tonal Movement specifier.
The JavaScript function 'drawGlyph' is called to draw the image.
Parameters passed to that function are: glyph image name; leading
movement from the previous glyph; total internal movement of the
glyph; and the CF.
If CharToShow is a clef, then the leading movement = the line
number (1 through 6) of the clef position; if no position was
specified, then the line number is 0.
-->
<xsl:template name="Glyph">
	<xsl:param name="CharToShow"/>
	<xsl:param name="Output"/>
	<xsl:param name="LineRemainder"/>
	<xsl:param name="CF"/>

	<!-- Set CF: -->
	<xsl:variable name="cf">
		<xsl:choose>
		<xsl:when test="$CF != '&objReplace;'">
			<xsl:call-template name="LookupCF">
				<xsl:with-param name="CF" select="$CF"/>
			</xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="10"/>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

	<xsl:choose>
		<!-- Clef sign: -->
		<xsl:when test="contains('&ClefSigns;', $CharToShow)">
			<xsl:variable name="SecondChar" select="substring($LineRemainder, 1, 1)"/>
			<xsl:variable name="ThirdChar" select="substring($LineRemainder, 2, 1)"/>
			<xsl:variable name="FourthChar" select="substring($LineRemainder, 3, 1)"/>
			<xsl:variable name="ClefPosition">
				<xsl:choose>
				<xsl:when test="contains('&ClefPositions;', $SecondChar)">
					<xsl:value-of select="$SecondChar"/>
				</xsl:when>
				<xsl:when test="contains('&ClefPositions;', $ThirdChar)">
					<xsl:value-of select="$ThirdChar"/>
				</xsl:when>
				<xsl:when test="contains('&ClefPositions;', $FourthChar)">
					<xsl:value-of select="$FourthChar"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="'&objReplace;'"/>
				</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>
			<xsl:variable name="LineNumber">
				<xsl:choose>
				<xsl:when test="$ClefPosition='&line1;'">1</xsl:when>
				<xsl:when test="$ClefPosition='&line2;'">2</xsl:when>
				<xsl:when test="$ClefPosition='&line3;'">3</xsl:when>
				<xsl:when test="$ClefPosition='&line4;'">4</xsl:when>
				<xsl:when test="$ClefPosition='&line5;'">5</xsl:when>
				<xsl:when test="$ClefPosition='&line6;'">6</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
				</xsl:choose>
			</xsl:variable>
			<SCRIPT type="text/javascript">
			drawGlyph('<xsl:value-of select="$CharToShow"/>',
			  '<xsl:value-of select="$Output"/>',
			  '<xsl:value-of select="$LineNumber"/>',
			  '0',
			  '<xsl:value-of select="$cf"/>');
			</SCRIPT>

		</xsl:when>

		<!-- Unheighted: -->
		<xsl:when test="$heighted='false'">
			<SCRIPT type="text/javascript">
			drawGlyph('<xsl:value-of select="$CharToShow"/>',
			  '<xsl:value-of select="$Output"/>',
			  '0',
			  '0',
			  '<xsl:value-of select="$cf"/>');
			</SCRIPT>
		</xsl:when>

		<!-- Glyphs having Tonal Movement: -->
		<xsl:otherwise>
			<!--Set Heighting:-->
			<xsl:variable name="returnValues">
				<xsl:call-template name="ComputeHeight">
					<xsl:with-param name="sequenceToParse" select="$LineRemainder"/>
				</xsl:call-template>
			</xsl:variable>
			<xsl:variable name="leadingMvmt"
				select="substring-before($returnValues, ',')"/>
			<xsl:variable name="internalMvmt"
				select="substring-after($returnValues, ',')"/>
			<!-- Returned leadingMvmt of 888 means UNK -->
			<SCRIPT type="text/javascript">
			drawGlyph('<xsl:value-of select="$CharToShow"/>',
				'<xsl:value-of select="$Output"/>',
				'<xsl:value-of select="$leadingMvmt"/>',
				'<xsl:value-of select="$internalMvmt"/>',
				'<xsl:value-of select="$cf"/>');
			</SCRIPT>
		</xsl:otherwise>
	</xsl:choose>

</xsl:template>

</xsl:stylesheet>
<!--[end, NeumesXML.xsl]-->