<?xml version="1.0" encoding="euc-kr"?>
<!--	
	1) 사업명 : 건설공사정보 DB구축 4차
	2) 주제   : 시공절차서(CG)/시공지침서(EI)
	3) 회사   : (주) SON Korea
	4) 화일명 : cicg.xsl
	5) 설명   : 시공절차서 Stylesheet
	6) 개발   : <<2004.08>>
	7) 수정   : <<2005.01.06>>
              2005/0623       - 목차 3Depth 까지 확장
-->
<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:user-namespace-here">
	<xsl:output method="xml" encoding="euc-kr" indent="yes"/>		
	<!-- 시공절차서/시공지침서 Root-->	
	<xsl:template match="/">
		<html>			
			<link href="style.css" rel="stylesheet" type="text/css" />
			<head>				
				<xsl:if test="kictdoc/@type='CG'">
					<title>시공절차서 : <xsl:value-of select="kictdoc/Metadata/dc:title"/></title>			
				</xsl:if>
				<xsl:if test="kictdoc/@type='EI'">
					<title>시공지침서 : <xsl:value-of select="kictdoc/Metadata/dc:title"/></title>			
				</xsl:if>
			</head>			
				<style>
					body {font-family:굴림;font-size:11pt;text-align:justify}
					th,td {font-family:굴림;font-size:11pt}					
					.sty0	{font-family : "", "u", "Arial", "sans-serif", "Times New Roman";
									font-size: 10px;
									line-height: normal;
									color: #CC0000;
									font-weight: bold;
						}
					.sty1	{	font-family : "", "u", "Arial", "sans-serif", "Times New Roman";
									font-size: 10px;
									font-weight: normal;
									color: #999999;
						}
				</style>		
				<style type="text/css">
				#box {height="100%"; overflow: auto; padding:0px;border:0 solid #F0A002; color: #F0A002;line-height:15pt;font-size:9pt;}
				#xxx1 {solid #F0AFF2; color: #F0A002;line-height:25pt;font-size:16pt;}
				</style>
				
				<!-- Load the Javascript -->
				<script language="javascript">
					<xsl:comment>
			var my_array = new Array();
			var inx = 0;
			function runprn()
			{
				window.print(this.form);
			}
			function rsimg()
			{
			box1.style.display = "inline";
			var x = document.images.length;
//			alert("onload imgsize: " + document.images.length);
				for(i=0;i &lt; document.images.length;i++) {
					var orgimg;							
					orgimg = document.images[i];
					
					var Wo = orgimg.width;
					var Ho = orgimg.height;
//					alert("orgimg.name : [" + i + "] : "+ orgimg.name);
					if(orgimg.name != null){
						if(orgimg.name.length > 0){
							var my_arr1 = new Array();
							my_arr1[0] = orgimg.name;
							my_arr1[1] = Wo;
							my_arr1[2] = Ho;
							my_array[inx] = my_arr1;
							inx++;
						}
					}
					if(Wo > 400) {
						orgimg.width = 400;
						orgimg.height = Ho * 400 / Wo;
					};
				}
			}		
			function openimg(imgname,id)
			{
			  var strurl = "";
				var wid = 0;
				var hei = 0;
				strurl = "./"+imgname;
				strurl = strurl.replace("img/", "img");
				strurl = strurl.replace("img", "img/");
				for(i=0;i &lt; inx;i++) {
					var arr = my_array[i];
					if(arr[0] == id){
//						alert(arr[0] + " : (" + arr[1] + "," + arr[2] + ")");
						wid = arr[1] + 10;
						hei = arr[2] + 30;
					}
				}

				var prop = "";
//				alert("screen.height:"+screen.height);
				if(screen.height &lt; hei){
					prop = "toolbar=no,menubar=no,status=no,titlebar=no,location=no,scrollbars=yes,left=5,top=5,width="+wid+",height="+(screen.height-88);
//					alert(prop);
				}
				else {
					prop = "toolbar=no,menubar=no,status=no,titlebar=no,location=no,left=5,top=5,width="+wid+",height="+hei;
				}
				
				
				window.open(strurl, "popimg", prop);
			}		

			function hiddentoc()
			{
				<!-- 출력용 -->
				if (box1.style.display == "inline"){
					box1.style.display = "none";

					// 타이틀/저자/날짜 출력부분
					toptb.width ="726";
					toptb.align ="left";
					toptb_bg1.width = "694";
					toptb_bg2.width = "694";
					toptb_bg3.width = "694";

					// body background image
					mainbody.background="";

					// content 형태 변경
					// left = 0
					// width = 695 - 290 : 405
					cont.style.left = 0;
					cont.style.width = 726;
					cont.style.overflow = "";

					standardfrm.style.display = "none";
					prnfrm.style.display = "inline";
					}
				<!-- 일반보기용 -->
				else {
					box1.style.display = "inline";

					// 타이틀/저자/날짜 출력부분
					toptb.width ="990";
					toptb.align ="center";
					toptb_bg1.width = "958";
					toptb_bg2.width = "958";
					toptb_bg3.width = "958";

					// body background image
					mainbody.background="images/textbox_bg.gif";

					// content 형태 변경
					// left = 290
					// width = 695
					cont.style.left = 290;
					cont.style.width = 695;
					cont.style.height = 430;
					cont.style.overflow = "auto";

					standardfrm.style.display = "inline";
					prnfrm.style.display = "none";
				}
			}
					</xsl:comment>
				</script>
			<body id="mainbody" bgcolor="#EDEFEE" background="images/textbox_bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="rsimg();">
				<div style="width:1000;height:100pt;z-index:1;padding-left:0pt;border=0px">
<table width="1000" height="100%" border="0" cellpadding="0" cellspacing="0">
	<tr valign="top"> 
		<td height="109" width="1000" colspan="2" align="center" background="images/xml_top_bg1.gif"> 
			<table width="990" border="0" cellpadding="0" cellspacing="0">
				<tr> 
					<td height="20" ></td>
				</tr>
				<tr> 
					<td width="100%" align="left" valign="bottom">
						<div id="standardfrm">
							<table width="100%">
								<tr>
									<td width="100%" align="left" valign="bottom">
										<img src="images/i_printview.gif" width="85" height="20" style="cursor:hand" onclick="hiddentoc();"/> 
										<img src="images/i_close.gif" width="52" height="20" style="cursor:hand" onclick="window.close();" />
									</td>
								</tr>
							</table>
						</div>
						<div id="prnfrm" style="display:none">
							<table width="100%">
								<tr>
									<td width="100%" align="left" valign="bottom">
										<img src="images/i_return.gif" width="85" height="20" style="cursor:hand" onclick="hiddentoc();"/> 
										<img src="images/i_print.gif" width="52" height="20" style="cursor:hand" onclick="runprn();"/> 
										<img src="images/i_close.gif" width="52" height="20" style="cursor:hand" onclick="window.close();" />
									</td>
								</tr>
							</table>
						</div>
					</td>

				</tr>
			</table>
			<table width="990" border="0" cellpadding="0" cellspacing="0" id="toptb" >
				<tr>
					<td width="100%" >
						<table width="100%" border="0" cellpadding="0" cellspacing="0" >
							<tr> 
								<td> 
									<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
										<tr> 
											<td width="16" height="16" valign="bottom" background="images/xml_box_01.gif"></td>
											<td id="toptb_bg1" width="958" height="16" background="images/xml_box_02.gif"></td>
											<td width="16" valign="bottom" background="images/xml_box_03.gif"></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr> 
								<td> 
									<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
										<tr> 
											<td width="16" background="images/xml_box_04.gif">&nbsp;</td>
											<td width="958" bgcolor="#FFFFFF" id="toptb_bg2">
												<table width="100%" border="0" cellpadding="0" cellspacing="0">
													<tr>
														<td width="60%" valign="top"> 
															<table border="0">
																<tr> 
																	<td height="20" align="right" class="At2">제목 :</td>
																	<td rowspan="2" valign="top" class="At3"><xsl:value-of select="kictdoc/Metadata/dc:title"/></td>
																</tr>
																<tr> 
																	<td height="20">&nbsp;</td>
																</tr>
															</table>
														</td>
														<td width="40%" valign="top" background="images/xml_box_line1.gif">
															<table border="0" align="right">
																<tr class="Acate"> 
																	<td height="20" align="right" class="At2">작성자 : </td>
																	<td class="At3"><xsl:value-of select="kictdoc/Metadata/dc:publisher"/></td>
																</tr>
																<tr class="Acate"> 
																	<td height="20" align="right" class="At2">날짜 :</td>
																	<td class="At3"><xsl:value-of select="kictdoc/Metadata/dc:date"/></td>
																</tr>
															</table> 
														</td>
													</tr>
												</table>
											</td>
											<td width="16" background="images/xml_box_05.gif">&nbsp;</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr> 
								<td> 
									<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
										<tr> 
											<td width="16" height="16" valign="top" background="images/xml_box_06.gif"></td>
											<td id="toptb_bg3" width="958" height="16" background="images/xml_box_08.gif"></td>
											<td width="16" height="16" valign="top" background="images/xml_box_07.gif"></td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
				</div>
				<div id="box1" style = "position:absolute;
								 padding-left:0pt;
							   padding-right:0pt;
							   width:284;
							   height:435;
							   z-index:2;
							   border:0px;
							   overflow:auto"> 			
			<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
				<tr> 
					<td valign="top" align="center"> 
						<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" >
							<tr> 
								<td height="16"> 
									<table width="260" border="0" cellpadding="0" cellspacing="0" align="center">
										<tr> 
											<td width="16" height="16" valign="bottom"><img src="images/xml_box_01.gif" width="16" height="16"/></td>
											<td height="16" background="images/xml_box_02.gif"><img src="images/xml_box_02.gif" width="16" height="16"/></td>
											<td width="16" valign="bottom"><img src="images/xml_box_03.gif" width="16" height="16"/></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr> 
								<td> 
									<table width="260" height="100%" border="0" cellpadding="0" cellspacing="0" align="center">
										<tr> 
											<td width="16" height="16" background="images/xml_box_04.gif">&nbsp;</td>
											<td valign="top" bgcolor="#FFFFFF">
<!-- 목차 출력 부분 시작 -->
					<xsl:apply-templates select= "kictdoc/toc"/>					
				  <xsl:copy-of select="$LOT"/>		<!-- 표목차 -->
				  <xsl:copy-of select="$LOF"/>		<!-- 그림목차 -->
				  <xsl:copy-of select="$LOP"/>		<!-- 사진목차 -->
<!-- 목차 출력 부분 끝 -->
											</td>	
											<td width="16" background="images/xml_box_05.gif">&nbsp;</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr> 
								<td height="16"> 
									<table width="260" border="0" cellpadding="0" cellspacing="0" align="center">
										<tr> 
											<td width="16" height="16" valign="top"><img src="images/xml_box_06.gif" width="16" height="16"/></td>
											<td background="images/xml_box_08.gif"><img src="images/xml_box_08.gif" width="16" height="16"/></td>
											<td width="16" valign="top"><img src="images/xml_box_07.gif" width="16" height="16"/></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td height="16">&nbsp;</td>
							</tr>
						</table>
					</td>
				</tr>
			</table> 
				</div>

				<div id="cont" style="position:absolute;width:695;height:430;z-index:2;left:290;top:140;overflow:auto">
					<xsl:apply-templates select= "kictdoc/chap"/>								
					<xsl:apply-templates select= "kictdoc/referenceInfo"/>								
				  <xsl:copy-of select="$LOI"/>														<!-- 인덱스 -->
				  <xsl:copy-of select="$LOQ"/>														<!-- 인용문 -->
  				<br/>
				</div>
			</body>			
		</html>
	</xsl:template>
	<!--
	=======================================================================================
	Tip : Call JavaScript from an XSLT style sheet
	=======================================================================================
	http://www-128.ibm.com/developerworks/xml/library/x-tipxsltjs/
	http://www.mydosu.com/LEC/XML/08xml_XSL-08.asp
	=======================================================================================
	이 예제는 msxml을 사용한 예제이지만 표준 xslt를 사용해도 가능할것으로 보임
	=======================================================================================
	-->
	
	<msxsl:script language="JScript" implements-prefix="user">
	<![CDATA[
	var ret_str="";
	var cur_level=0;
	chap_level_vector = new Array(4)	
	chap_stlevel_vector = new Array(4)
	chap_cid_vector = new Array(4)
	chap_level_vector[0]="0";
	chap_level_vector[1]="1";
	chap_level_vector[2]="2";
	chap_level_vector[3]="3";
	chap_stlevel_vector[0]="0";
	chap_stlevel_vector[1]="1";
	chap_stlevel_vector[2]="2";
	chap_stlevel_vector[3]="3";
	chap_cid_vector[0]="0";
	chap_cid_vector[1]="1";
	chap_cid_vector[2]="2";
	chap_cid_vector[3]="3";

	ch_prefix_1 = new Array("je", "제");
	ch_prefix_2 = new Array("ch", "Chapter");
	ch_prefix_3 = new Array("lb1", "{");
	ch_prefix_4 = new Array("lb2", "[");
	ch_prefix_5 = new Array("lb3", "<");
	ch_prefix_6 = new Array("lb4", "(");

	chap_prefix_vector = new Array(ch_prefix_1,ch_prefix_2,ch_prefix_3,ch_prefix_4,ch_prefix_5,ch_prefix_6);

	ch_suffix_1 = new Array("ja", "장");
	ch_suffix_2 = new Array("je", "절");
	ch_suffix_3 = new Array("gu", "구");
	ch_suffix_4 = new Array("ku", "권");
	ch_suffix_5 = new Array("rb1", "}");
	ch_suffix_6 = new Array("rb2", "]");
	ch_suffix_7 = new Array("rb3", ">");
	ch_suffix_8 = new Array("rb4", ")");
	ch_suffix_9 = new Array("dot", ".");

	chap_suffix_vector = new Array(ch_suffix_1,ch_suffix_2,ch_suffix_3,ch_suffix_4,ch_suffix_5,ch_suffix_6,ch_suffix_7,ch_suffix_8,ch_suffix_9);

	ch_ntype_1 = new Array("Aribic","1" ,"2" ,"3" ,"4" ,"5" ,"6" ,"7" ,"8" ,"9" ,"10"
	                               ,"11","12","13","14","15","16","17","18","19","20");
	ch_ntype_2 = new Array("AribicC" ,"①" ,"②" ,"③" ,"④" ,"⑤" ,"⑥" ,"⑦" ,"⑧" ,"⑨" ,"⑩" ,"⑪" ,"⑫" ,"⑬" ,"⑭" ,"⑮");
	ch_ntype_3 = new Array("AribicL" ,"⑴" ,"⑵" ,"⑶" ,"⑷" ,"⑸" ,"⑹" ,"⑺" ,"⑻" ,"⑼" ,"⑽" ,"⑾" ,"⑿" ,"⒀" ,"⒁" ,"⒂");

	ch_ntype_4 = new Array("GANADA" ,"가" ,"나" ,"다" ,"라" ,"마" ,"바" ,"사" ,"아" ,"자" ,"차" ,"카" ,"타" ,"파" ,"하");
	ch_ntype_5 = new Array("GANADAC","㉮" ,"㉯" ,"㉰" ,"㉱" ,"㉲" ,"㉳" ,"㉴" ,"㉵" ,"㉶" ,"㉷" ,"㉸" ,"㉹" ,"㉺" ,"㉻");
	ch_ntype_6 = new Array("GANADAL","㈎" ,"㈏" ,"㈐" ,"㈑" ,"㈒" ,"㈓" ,"㈔" ,"㈕" ,"㈖" ,"㈗" ,"㈘" ,"㈙" ,"㈚" ,"㈛");

	ch_ntype_7 = new Array("HJAUM"  ,"ㄱ" ,"ㄴ" ,"ㄷ" ,"ㄹ" ,"ㅁ" ,"ㅂ" ,"ㅅ" ,"ㅇ" ,"ㅈ" ,"ㅊ" ,"ㅋ" ,"ㅌ" ,"ㅍ" ,"ㅎ");
	ch_ntype_8 = new Array("HJAUMC" ,"㉠" ,"㉡" ,"㉢" ,"㉣" ,"㉤" ,"㉥" ,"㉦" ,"㉧" ,"㉨" ,"㉩" ,"㉪" ,"㉫" ,"㉬" ,"㉭");
	ch_ntype_9 = new Array("HJAUML" ,"㈀" ,"㈁" ,"㈂" ,"㈃" ,"㈄" ,"㈅" ,"㈆" ,"㈇" ,"㈈" ,"㈉" ,"㈊" ,"㈋" ,"㈌" ,"㈍");

	ch_ntype_10 = new Array("Alphabets" ,"a" ,"b" ,"c" ,"d" ,"e" ,"f" ,"g" ,"h" ,"i" ,"j" ,"k" ,"l" ,"m"
	                                    ,"n" ,"o" ,"p" ,"q" ,"r" ,"s" ,"t" ,"u" ,"v" ,"w" ,"x" ,"y" ,"z");
	ch_ntype_11 = new Array("AlphabetsC","ⓐ" ,"ⓑ" ,"ⓒ" ,"ⓓ" ,"ⓔ" ,"ⓕ" ,"ⓖ" ,"ⓗ" ,"ⓘ" ,"ⓙ" ,"ⓚ" ,"ⓛ" ,"ⓜ" 
	                                    ,"ⓝ" ,"ⓞ" ,"ⓟ" ,"ⓠ" ,"ⓡ" ,"ⓢ" ,"ⓣ" ,"ⓤ" ,"ⓥ" ,"ⓦ" ,"ⓧ" ,"ⓨ" ,"ⓩ");
	ch_ntype_12 = new Array("AlphabetsL","⒜" ,"⒝" ,"⒞" ,"⒟" ,"⒠" ,"⒡" ,"⒢" ,"⒣" ,"⒤" ,"⒥" ,"⒦" ,"⒧" ,"⒨" 
	                                    ,"⒩" ,"⒪" ,"⒫" ,"⒬" ,"⒭" ,"⒮" ,"⒯" ,"⒰" ,"⒱" ,"⒲" ,"⒳" ,"⒴" ,"⒵");

	ch_ntype_13 = new Array("AlphabetL","A" ,"B" ,"C" ,"D" ,"E" ,"F" ,"G" ,"H" ,"I" ,"J" ,"K" ,"L" ,"M"
	                                   ,"N" ,"O" ,"P" ,"Q" ,"R" ,"S" ,"T" ,"U" ,"V" ,"W" ,"X" ,"Y" ,"Z");
	ch_ntype_14 = new Array("ROMAs" ,"I" ,"II" ,"III" ,"IV" ,"V" ,"VI" ,"VII" ,"VIII" ,"IX" ,"X");
	ch_ntype_15 = new Array("ROMAL" ,"i" ,"ii" ,"iii" ,"iv" ,"v" ,"vi" ,"vii" ,"viii" ,"ix" ,"x");
	
	chap_numtype_vector = new Array(ch_ntype_1,  ch_ntype_2,  ch_ntype_3,  ch_ntype_4,  ch_ntype_5,  
	                                ch_ntype_6,  ch_ntype_7,  ch_ntype_8,  ch_ntype_9,  ch_ntype_10, 
																	ch_ntype_11, ch_ntype_12, ch_ntype_13, ch_ntype_14, ch_ntype_15);

	ch_divletter_1 = new Array("dash", "-");
	ch_divletter_2 = new Array("dot", ".");
	chap_divletter_vector = new Array(ch_divletter_1,ch_divletter_2);

	function set_chap_level(level, level)
	{
		chap_level_vector[level]=level;
		return "";
	}
	function set_chap_stlevel(level, stlevel)
	{
		chap_stlevel_vector[level]=stlevel;
		return "";
	}
	function set_chap_cid(level, cid)
	{
		chap_cid_vector[level]=cid;
		return "";
	}
	function get_chap_level(level)
	{
		ret_str = "[";
		ret_str = ret_str + chap_level_vector[level]
		ret_str = ret_str + "]"
		return ret_str 
	}
	function get_chap_stlevel(level)
	{
		ret_str = "[";
		ret_str = ret_str + chap_stlevel_vector[level]
		ret_str = ret_str + "]"
		return ret_str 
	}
	function get_chap_cid(level)
	{
		ret_str = "[";
		ret_str = ret_str + chap_cid_vector[level]
		ret_str = ret_str + "]"
		return ret_str 
	}
	function get_my_string(stlevel, level, prefix, suffix, numtype, divletter)
	{
		var i;
		ret_str = "";
		if(prefix.length > 0) ret_str = get_prefix(prefix);

		for(i=stlevel; i<=level; i++)
		{
			ret_str = ret_str + get_NumType(numtype, chap_cid_vector[i]);
			if(divletter.length > 0 && stlevel != level && (i != level)) 
				ret_str = ret_str + get_divletter(divletter);
		}
//		if(prefix.length > 0) ret_str =  + ' ' + ret_str;
		if(suffix.length > 0) ret_str = ret_str + get_suffix(suffix);
		return ret_str + "&nbsp;";
	}
	function get_NumType(numtype, cid)
	{
			var inx;
			ret_str = "";
			var objx = ch_ntype_1;

			if(numtype == "Aribic"){						objx = ch_ntype_1;		}
			else if(numtype == "AribicC"){			objx = ch_ntype_2;		}
			else if(numtype == "AribicL"){			objx = ch_ntype_3;		}
			else if(numtype == "GANADA"){				objx = ch_ntype_4;		}
			else if(numtype == "GANADAC"){			objx = ch_ntype_5;		}
			else if(numtype == "GANADAL"){			objx = ch_ntype_6;		}
			else if(numtype == "HJAUM"){				objx = ch_ntype_7;		}
			else if(numtype == "HJAUMC"){				objx = ch_ntype_8;		}
			else if(numtype == "HJAUML"){				objx = ch_ntype_9;		}
			else if(numtype == "Alphabets"){		objx = ch_ntype_10;		}
			else if(numtype == "AlphabetsC"){		objx = ch_ntype_11;		}
			else if(numtype == "AlphabetsL"){		objx = ch_ntype_12;		}
			else if(numtype == "AlphabetL"){		objx = ch_ntype_13;		}
			else if(numtype == "ROMAs"){				objx = ch_ntype_14;		}
			else if(numtype == "ROMAL"){				objx = ch_ntype_15;		}
			else {															objx = ch_ntype_1;		}
			
			if(cid < objx.length)		ret_str = objx[cid];

			return ret_str;
	}

	function get_divletter(divstr)
	{
		var inx;
		ret_str = "";
		for(inx = 0 ; inx < chap_divletter_vector.length; inx++){
				var objx = chap_divletter_vector[inx];
				if(objx[0] == divstr) ret_str = objx[1];
		}
		return ret_str;
	}
	function get_prefix(prefix)
	{
		var inx;
		ret_str = "";
		for(inx = 0 ; inx < chap_prefix_vector.length; inx++){
				var objx = chap_prefix_vector[inx];
				if(objx[0] == prefix) ret_str = objx[1];
		}
		return ret_str;
	}

	function get_suffix(suffix)
	{
		var inx;
		ret_str = "";
		for(inx = 0 ; inx < chap_suffix_vector.length; inx++){
				var objx = chap_suffix_vector[inx];
				if(objx[0] == suffix) ret_str = objx[1];
		}
		return ret_str;
	}

	function get_levelspace(level)
	{
		var inx;
		ret_str = "";
		for(inx = 1 ; inx < level; inx++){
				ret_str = ret_str + "&nbsp;";
		}
		return ret_str;
	}
	]]>
	</msxsl:script>


	<!-- ==================================================== -->
	<!-- 목차 생성 																						-->
	<!-- ==================================================== -->
	<xsl:template match="toc">					
		<font class="Bt1"><strong>목   &nbsp;&nbsp;차 (Table Of Contents)</strong></font><br/>
		<xsl:for-each select="//chap[@level=1 or @level=2 or @level=3 or @level=4 or @level=5 or @level=6 ]">					
			<!-- XSLT 변수 할당 -->
			<xsl:variable name="chlvl" select="@level" />
			<xsl:variable name="chstlvl" select="@stlevel" />
			<xsl:variable name="chpre" select="@prefix" />			<!-- add by csb 2005.09.21 -->
			<xsl:variable name="chcid" select="@cid" />
			<xsl:variable name="chsuf" select="@suffix" />			<!-- add by csb 2005.09.21 -->
			<xsl:variable name="chnum" select="@numtype" />			<!-- add by csb 2005.09.21 -->
			<xsl:variable name="div" select="@divletter" />			<!-- add by csb 2005.09.21 -->
			<!-- XSLT변수를 자바스크립트의 배열로 카피 -->
			<xsl:value-of select="user:set_chap_level(number($chlvl), string($chlvl))" disable-output-escaping="yes"/>
			<xsl:value-of select="user:set_chap_stlevel(number($chlvl), string($chstlvl))" disable-output-escaping="yes"/>
			<xsl:value-of select="user:set_chap_cid(number($chlvl), string($chcid))" disable-output-escaping="yes"/>

			<!-- chap의 앞부분에 레벨별 공백을 넣어준다. -->
			<xsl:value-of select="user:get_levelspace(number($chlvl))" disable-output-escaping="yes"/>

			<!-- 목차출력하는 부분은 동일하며 단지 레벨에따른 폰트만 달리한다. -->
			<xsl:if test="@level=1">
				<font class="Bt2">
					<xsl:element name="a">
					<xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:number/></xsl:attribute>							
					<xsl:value-of select="user:get_my_string(number($chstlvl), number($chlvl), string($chpre), string($chsuf), string($chnum), string($div))" disable-output-escaping="yes"/>
					<xsl:value-of select="title"/>
					</xsl:element>
				</font>
			</xsl:if>
			<xsl:if test="@level=2">
				<font class="Bt3">
					<xsl:element name="a">
					<xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:number/></xsl:attribute>							
					<xsl:value-of select="user:get_my_string(number($chstlvl), number($chlvl), string($chpre), string($chsuf), string($chnum), string($div))" disable-output-escaping="yes"/>
					<xsl:value-of select="title"/>
					</xsl:element>
				</font>
			</xsl:if>
			<xsl:if test="@level=3 or @level=4 or @level=5 or @level=6">
				<font class="Ct4">
					<xsl:element name="a">
					<xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:number/></xsl:attribute>							
					<xsl:value-of select="user:get_my_string(number($chstlvl), number($chlvl), string($chpre), string($chsuf), string($chnum), string($div))" disable-output-escaping="yes"/>
					<xsl:value-of select="title"/>
					</xsl:element>
				</font>
			</xsl:if>
			<br/>
		</xsl:for-each>				
	</xsl:template>

	<!-- ==================================================== -->
	<!-- 표목차 (List of Table) 							   							-->
	<!-- ==================================================== -->
<xsl:variable name = "LOT">
	<xsl:if test="count(//table) > 0">
		<br/><br/><font class="Bt1"><strong>표 목 차</strong></font><br/>
	</xsl:if>
	<xsl:for-each select="//table">
			<font class="Bt3">
				<xsl:element name="a">
					<xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@id"/>
					</xsl:attribute><xsl:value-of select="title"/><br/>
				</xsl:element>
			</font>
	</xsl:for-each>
</xsl:variable>

	<!-- ==================================================== -->
	<!-- 그림목차 (List of Figure) 														-->
	<!-- ==================================================== -->
<xsl:variable name = "LOF">
	<xsl:if test="count(//img[@type='IMG']) > 0">
		<br/><br/><font class="Bt1"><strong>그 림 목 차</strong></font><br/>
	</xsl:if>
	<xsl:for-each select="//img">
		<xsl:if test="@type='IMG'">
				<font class="Bt3">
					<xsl:element name="a">
						<xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@id"/>
						</xsl:attribute><xsl:value-of select="@title"/><br/>
					</xsl:element>
				</font>
		</xsl:if>
	</xsl:for-each>
</xsl:variable>

	<!-- ==================================================== -->
	<!-- 사진목차 (List of Photo) 														-->
	<!-- ==================================================== -->
<xsl:variable name = "LOP">
	<xsl:if test="count(//img[@type='PHOTO']) > 0">
		<br/><br/><font class="Bt1"><strong>사 진 목 차</strong></font><br/>
	</xsl:if>
	<xsl:for-each select="//img">
		<xsl:if test="@type='PHOTO'">
				<font class="Bt3">
					<xsl:element name="a">
						<xsl:attribute name="href"><xsl:text>#</xsl:text><xsl:value-of select="@id"/>
						</xsl:attribute><xsl:value-of select="@title"/><br/>
					</xsl:element>
				</font>
		</xsl:if>
	</xsl:for-each>
</xsl:variable>

	<!-- ==================================================== -->
	<!-- 장		 																								-->
	<!-- ==================================================== -->
	<xsl:template match="chap">	
		<div  style="text-align:left;
									padding-top:10pt;
									padding-left:{@level*15}pt;
									text-indent:0pt;
									line-height:10pt;">			
			<a>
				<xsl:attribute name="name"> 
					<xsl:number/>
				</xsl:attribute>
			</a>

			<!-- XSLT 변수 할당 -->
			<xsl:variable name="chap_level" select="@level" />
			<xsl:variable name="chap_stlevel" select="@stlevel" />
			<xsl:variable name="chap_prefix" select="@prefix" />			<!-- add by csb 2005.09.21 -->
			<xsl:variable name="chap_cid" select="@cid" />
			<xsl:variable name="chap_suffix" select="@suffix" />			<!-- add by csb 2005.09.21 -->
			<xsl:variable name="chap_numtype" select="@numtype" />		<!-- add by csb 2005.09.21 -->
			<xsl:variable name="divletter" select="@divletter" />		<!-- add by csb 2005.09.21 -->

			<!-- XSLT변수를 자바스크립트의 배열로 카피 -->
			<xsl:value-of select="user:set_chap_level(number($chap_level), string($chap_level))" disable-output-escaping="yes"/>
			<xsl:value-of select="user:set_chap_stlevel(number($chap_level), string($chap_stlevel))" disable-output-escaping="yes"/>
			<xsl:value-of select="user:set_chap_cid(number($chap_level), string($chap_cid))" disable-output-escaping="yes"/>

			<!-- 자바스크립트의 배열에서 원하는 문자열을 가져옴 -->
			<font class="Ct2" style="line-height:10pt;">
			<xsl:value-of select="user:get_levelspace(number($chap_level))" disable-output-escaping="yes"/>
			<xsl:value-of select="user:get_my_string(number($chap_stlevel), number($chap_level), string($chap_prefix), string($chap_suffix), string($chap_numtype), string($divletter))" disable-output-escaping="yes"/>
			</font>
			<xsl:apply-templates select= "*"/>

			<!-- 현재 chap 하위에 있는 모든 annotation을 읽어들인다. -->
			<xsl:if test="*//annotation">
				<xsl:for-each select="*//annotation">		
					<font class="sty0">(주)<xsl:value-of select="@id"/></font>&nbsp;&nbsp;<font class="sty1"><xsl:value-of select="."/> : <xsl:value-of select="@desc"/></font><br/>
				</xsl:for-each>
				<br/>
			</xsl:if>
		</div>	
	</xsl:template>


	<!-- ==================================================== -->
	<!--annotation																						-->
	<!-- ==================================================== -->		
	<xsl:template match="annotation">		
				<xsl:value-of select="."/><sup><font class="sty0">(주)<xsl:value-of select="@id"/></font></sup>
	</xsl:template>						

	<!-- ==================================================== -->
	<!--Title																									-->
	<!-- ==================================================== -->		
	<xsl:template match="title">		
		<font class="Ct2" style="line-height:10pt;">
			<xsl:value-of select="."/>
		</font>					
	</xsl:template>						

	
	<!-- ==================================================== -->
	<!-- 리스트																								-->
	<!-- ==================================================== -->	
	<xsl:template match="list">			
		<xsl:if test="header !=''">
			<div style="font-weight:bold;
									padding-top:20pt;
									padding-left:15pt;
									text-indent:-10pt;
									line-height:20pt;">
				<xsl:value-of select="header"/>	
			</div>			
		</xsl:if>			
		<xsl:apply-templates select= "item"/>
		<xsl:apply-templates select= "img"/>
		<xsl:apply-templates select= "table"/>
	</xsl:template>	

	<!-- ==================================================== -->
	<!--리스트 아이템																					-->
	<!-- ==================================================== -->	
	<xsl:template match="item">				
		<div style="padding-top :0pt ; 					 
					 padding-left:15pt ; 
					 text-indent:-10pt;
		       line-height:20pt;" class="Ct4">			
			<xsl:apply-templates select= "*|@*|text()"/>											
<!--
			<xsl:apply-templates select= "img"/>												
-->
		</div>												
	</xsl:template>	
	
	<!-- ==================================================== -->
	<!-- 문단																									-->
	<!-- ==================================================== -->
	<xsl:template match="p">	
		<xsl:choose>
			<xsl:when test="true()=//td/p or true()=//item/p">
				<div  style="padding-left:0pt;
											padding-top:5pt;
											text-indent:0pt;
											line-height:20pt;" 
											class="Ct4">
					<xsl:apply-templates select="*|@*|text()"/>					
				</div>												
			</xsl:when>
			<xsl:otherwise>
				<div  style="padding-left:0pt;
											padding-top:10pt;
											text-indent:0pt;
											line-height:20pt;"
											class="Ct4">
					<xsl:apply-templates select="*|@*|text()"/>					
				</div>								
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>	

	<!-- ==================================================== -->
	<!-- 수식														 											-->
	<!-- ==================================================== -->
	<xsl:template match="form">
		<xsl:value-of select="text()"/>
		<xsl:apply-templates select= "img"/>												
	</xsl:template>	

	<!-- ==================================================== -->
	<!-- 이미지																								-->
	<!-- ==================================================== -->
	<xsl:template match="img">		
		<xsl:if test="true()!=//form/img">
			<br/>
		</xsl:if>		
		<center>
		<xsl:element name="a">
		<xsl:attribute name="href">javascript:openimg('<xsl:value-of select="@src"/>','i_<xsl:value-of select="@id"/>')</xsl:attribute>
		<img>
			<xsl:attribute name="name">i_<xsl:value-of select="@id"/></xsl:attribute>
			<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
			<xsl:attribute name="border">0</xsl:attribute>
			<xsl:if test="@width">
				<xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>					
			</xsl:if>
			<xsl:if test="@height">
				<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@caption">
				<xsl:attribute name="alt"><xsl:value-of select="@caption"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@class">
				<xsl:attribute name="class"><xsl:value-of select="@class"/></xsl:attribute>								
			</xsl:if>						
			<xsl:if test="@src">
				<xsl:attribute name="src"><xsl:value-of select="@src"/></xsl:attribute>								
			</xsl:if>
		</img>
		</xsl:element>
		</center>
		<br/>
		<center><font class="Ct4"><xsl:value-of select="title"/></font></center><br/>
	</xsl:template>	

	<!-- ==================================================== -->
	<!-- 테이블 정의																					-->
	<!-- ==================================================== -->
	<xsl:template match="table">		
		<center>
		<xsl:element name="a">
			<xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute>
		</xsl:element>
		<table border="0">
			<tr>
				<td style="text-align:center;font-weight:bold" class="Ct4">
					<xsl:if test="title"><xsl:value-of select="title"/></xsl:if>
				</td>
			</tr>
			<tr>
				<td style="text-align:right;font-weight:normal" class="Ct4">
					<xsl:if test="symdesc"><xsl:value-of select="symdesc"/></xsl:if >
				</td>
			</tr>
			<tr>
				<td>
					<table border="1"  align="center" cellspacing="0pt" cellpadding="10pt">
						<xsl:apply-templates select="tr"/>
					</table>
				</td>
			</tr>
			<tr>
				<td style="text-align:left;" class="Ct4">
					<xsl:if test="desc"><xsl:value-of select="desc"/></xsl:if>
				</td>
			</tr>				
			<tr>
				<td style="text-align:left;" class="Ct4">
					<xsl:if test="origin">출처 : <xsl:value-of select="origin"/></xsl:if>
				</td>
			</tr>			
		</table>
		<xsl:if test="count(img) > 0">
		<xsl:apply-templates select= "img"/>
		</xsl:if>
		</center>
	</xsl:template>			

	<!-- ==================================================== -->
	<!-- tr																										-->
	<!-- ==================================================== -->
	<xsl:template match="tr">
		<tr>
 		   <xsl:if test="@align">
				<xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@valign">
				<xsl:attribute name="valign"><xsl:value-of select="@valign"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@style">
				<xsl:attribute name="style"><xsl:value-of select="@style"/></xsl:attribute>								
			</xsl:if>			
			<xsl:apply-templates select="*|text()"/>
		</tr>	
	</xsl:template>

	<!-- ==================================================== -->
	<!-- td																										-->
	<!-- ==================================================== -->
	<xsl:template match="td">
		<td class="Ct4">
			<xsl:if test="@colspan">
				<xsl:attribute name="colspan"><xsl:value-of select="@colspan"/></xsl:attribute>								
			</xsl:if>			

			<xsl:if test="@rowspan">
				<xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute>								
			</xsl:if>			

			<xsl:if test="@align">
				<xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>								
			</xsl:if>			

			<xsl:if test="@valign">
				<xsl:attribute name="valign"><xsl:value-of select="@valign"/></xsl:attribute>								
			</xsl:if>			

			<xsl:if test="@width">
				<xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>								
			</xsl:if>			

			<xsl:if test="@height">
				<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@style">
				<xsl:attribute name="style"><xsl:value-of select="@style"/>;line-height:10pt</xsl:attribute>
			</xsl:if>										
			<xsl:apply-templates select="*|text()"/>&nbsp;								
		</td>	
	</xsl:template>

	<!-- ==================================================== -->
	<!--sub																										-->
	<!-- ==================================================== -->		
	<xsl:template match="sub">		
	      <sub>
			<xsl:value-of select="text()"/>
		</sub>
	</xsl:template>						

	<!-- ==================================================== -->
	<!--sup																										-->
	<!-- ==================================================== -->		
	<xsl:template match="sup">		
	      <sup>
			<xsl:value-of select="text()"/>
		</sup>
	</xsl:template>						

	<!-- ==================================================== -->
	<!--sup																										-->
	<!-- ==================================================== -->		
	<xsl:template match="font">		
		<font>
			<xsl:if test="@famliy"> 	
				<xsl:attribute name="face">
					<xsl:value-of select="@famliy"/>
				</xsl:attribute>
			</xsl:if>				
			<xsl:if test="@size"> 	
				<xsl:attribute name="size">
					<xsl:value-of select="@size"/>
				</xsl:attribute>
			</xsl:if>				
			<xsl:if test="@color"> 	
				<xsl:attribute name="color">
					<xsl:value-of select="@color"/>
				</xsl:attribute>
			</xsl:if>				
			<xsl:if test="@style"> 	
				<xsl:attribute name="style">
					<xsl:value-of select="@style"/>
				</xsl:attribute>
			</xsl:if>							
			<xsl:value-of select="text()"/>
		</font>					
	</xsl:template>						
	
	<!-- ==================================================== -->
	<!-- th													 -->
	<!-- ==================================================== -->
	<xsl:template match="th">
		<th>
			<xsl:if test="@colspan">
				<xsl:attribute name="colspan"><xsl:value-of select="@colspan"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@rowspan">
				<xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@align">
				<xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@valign">
				<xsl:attribute name="valign"><xsl:value-of select="@valign"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@width">
				<xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@height">
				<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>								
			</xsl:if>			
			<xsl:if test="@style">
				<xsl:attribute name="style"><xsl:value-of select="@style"/> ;line-height:10pt</xsl:attribute>								
			</xsl:if>			
			<xsl:apply-templates select="*|text()"/>					
		</th>	
	</xsl:template>

<!-- ###################################################################################################### -->
<!-- 요부분까지 적용 테스트 함....																																					-->
<!-- 작성자 : SON Korea 																																										-->
<!-- 작성일 : 2005-01-06 																																										-->
<!-- ###################################################################################################### -->
	<!-- ==================================================== -->
	<!-- 참고문헌												 											-->
	<!-- ==================================================== -->
	<xsl:template match="referenceInfo">
		<div  style="text-align:left;
									padding-top:10pt;
									padding-left:{2*15}pt;
									padding-right:{2*15}pt;
									text-indent:0pt;
									line-height:10pt;;border=3px">			
			<br/><br/><br/><center><font class="Ct1">참 고 문 헌</font></center><br/>
			<table width="630">
			<xsl:apply-templates select= "reference"/>
			</table>
			<br/>
		</div>	
	</xsl:template>	

	<xsl:template match="reference">
		<tr>
			<td width="10" valign="top">
				<font class="Ct4"><xsl:value-of select="@id"/>.</font>
			</td>
			<td width="620">
				<font class="Ct4">
					<xsl:if test="count(type) = 0">
							<xsl:value-of select="."/>
					</xsl:if>
					<xsl:if test="count(type) > 0">
						<xsl:if test="count(url) = 0">
							<xsl:value-of select="reftitle"/>&nbsp;&nbsp;
						</xsl:if>
						<xsl:if test="url!=''">
							<xsl:element name="a">
									<xsl:attribute name="href"><xsl:value-of select="url"/></xsl:attribute>							
									<xsl:attribute name="target">_NEW</xsl:attribute>							
									<xsl:value-of select="reftitle"/>
							</xsl:element>						
						</xsl:if>
						&nbsp;&nbsp;<xsl:apply-templates select= "format"/>
						&nbsp;&nbsp;<xsl:apply-templates select= "publishinfo"/>
						&nbsp;&nbsp;<xsl:apply-templates select= "author"/>,&nbsp;&nbsp;<xsl:value-of select="annexation"/>
					</xsl:if>
				</font>
			</td>
		</tr>
	</xsl:template>	

	<xsl:template match="type">
		<xsl:value-of select="."/>				
	</xsl:template>	

	<xsl:template match="reftitle">
		<b><xsl:value-of select="."/></b>
	</xsl:template>	

	<xsl:template match="format">
		(vol : <xsl:value-of select="vol"/>&nbsp;,
		no : <xsl:value-of select="no"/>&nbsp;,
		part : <xsl:value-of select="part"/>)
	</xsl:template>	

	<xsl:template match="publishinfo">
		,&nbsp;&nbsp;<xsl:value-of select="publisher"/>&nbsp;, <xsl:value-of select="date"/>
	</xsl:template>	

	<xsl:template match="author">
		,&nbsp;&nbsp;<xsl:value-of select="."/>
	</xsl:template>	

	<!-- ==================================================== -->
	<!-- 인덱스 (List of Index) 							   							-->
	<!-- ==================================================== -->
	<xsl:variable name = "LOI">
		<xsl:if test="count(//index) > 0">
			<div  style="text-align:left;
										padding-top:10pt;
										padding-left:{2*15}pt;
										padding-right:{2*15}pt;
										text-indent:0pt;
										line-height:10pt;;border=3px">			
				<br/><br/><br/><center><font class="Ct1">인  덱  스</font></center><br/>
				<xsl:for-each select="//index">
						<font class="Ct4">
							<xsl:value-of select="."/> : <xsl:value-of select="@desc"/>
						</font><br/>
				</xsl:for-each>
			</div>	
		</xsl:if>
	</xsl:variable>

	<!-- ==================================================== -->
	<!-- 인용 (List of Quotation)							   							-->
	<!-- ==================================================== -->
	<xsl:variable name = "LOQ">
		<xsl:if test="count(//quotation) > 0">
			<div  style="text-align:left;
										padding-top:10pt;
										padding-left:{2*15}pt;
										padding-right:{2*15}pt;
										text-indent:0pt;
										line-height:10pt;;border=3px">			
				<br/><br/><br/><center><font class="Ct1">인  용  문</font></center><br/>
				<xsl:for-each select="//quotation">
						<font class="Ct4">
							<xsl:value-of select="."/> : <xsl:value-of select="@desc"/>
						</font><br/>
				</xsl:for-each>
			</div>	
		</xsl:if>
	</xsl:variable>

</xsl:stylesheet>
