<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:import href="Section.xsl"/>
	<xsl:output method="html" indent="yes" omit-xml-declaration="yes"/>
	<xsl:param name="thisXsl" select="'NextXmile.xsl'" />
	<xsl:param name="paShadow" select="'box-shadow: 0 0 7px rgba(0,0,0,0.3); border-radius: 3px;border: 1px #888888 dotted; '" />
	<xsl:template match="ShowPage" mode="content">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tbody>
				<tr>
					<td id="baseTD">
						<xsl:apply-templates select="." mode="MainText" />
					</td>
				</tr>
			</tbody>
		</table>
		<xsl:choose>
			<xsl:when test="xmileres">
				<textarea name="feedback" id="feedback" style="margin-bottom: 7px; width: 670px; height: 300px; overflow: scroll; {$paShadow}" >
					<xsl:apply-templates select="xmileres" />
				</textarea>
				<button onclick="copyDivContent()" style="margin-right: 3px;{$paShadow}">Copy diagnostics</button>
				<button onclick="showSFD('image')" style="margin-right: 3px;{$paShadow}">View SFD</button>
				<button onclick="showSFD('xmile')" style="margin-right: 3px;{$paShadow}">Download (Vensim)</button>
				<button onclick="showSFD('pysd')" style="margin-right: 3px;{$paShadow}">Download (Stella)</button>
				<button onclick="goBack()" style="margin-right: 3px;{$paShadow}">Back to project</button>
				<br />
				<div id="outp" style="width: 670px; height: 6px; margin-top: 7px; margin-bottom: 2px;"></div>
				<script>
					function insertClipbrd(){
					const divOutp = document.getElementById('outp');
					const textarea = document.getElementById('feedback');
					navigator.clipboard.readText();
					alert(navigator.clipboardText);
					textarea.value = navigator.clipboardText;
					divOutp.textcontent = 'Copied from clipboard!';
					}
					async function copyDivContent() {
					//const divElement = document.getElementById('feedback');
					//const textToCopy = divElement.innerText;
					const textarea = document.getElementById('feedback');
					const divOutp = document.getElementById('outp');

					try {
					await navigator.clipboard.writeText(textarea.value);
					//alert('Inhalt wurde erfolgreich kopiert!');
					divOutp.textContent = 'Copied into clipboard!';
					} catch (err) {
					console.error('Kopieren ist fehlgeschlagen: ', err);
					//alert('Fehler beim Kopieren des Textes.');
					divOutp.textContent = 'Fehler beim Kopieren des Textes.';
					}
					}
					function showSFD(key) {
					window.location.href = '?m=xmile&amp;param='+key+'&amp;f=<xsl:value-of select="@id" />';
					}
					function goBack(){
					window.location.href = '?f=<xsl:value-of select="@super" />';
					}
				</script>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="ShowPage" mode="showLinks">
		<xsl:text> | </xsl:text>
		<a style="text-decoration: none;" target="_evaxmile" href="info.aspx?f={@id}&amp;v=auswerten.xsl&amp;device=IE40">≡</a>
	</xsl:template>
	<xsl:template match="Subobj" mode="link">
		<xsl:param name="target" select="''"/>
		<xsl:variable name="type" select="translate(substring-after(@name,'.'),'JPENGIFXML','jpengifxml')"/>
		<xsl:choose>
			<xsl:when test="sTemplate='PrivateFile' and ($type='gif' or $type='jpg' or $type='jpeg' or $type='png')">
				<xsl:attribute name="href">
					<xsl:value-of select="/ShowPage/Script"/>
					<xsl:text>?f=</xsl:text>
					<xsl:value-of select="@id"/>
					<xsl:text>&amp;v=imgview.xsl</xsl:text>
				</xsl:attribute>
				<xsl:if test="$target !=''">
					<xsl:attribute name="target">
						<xsl:value-of select="$target"/>
					</xsl:attribute>
				</xsl:if>
			</xsl:when>
			<xsl:when test="sTemplate='PrivateFile' and ($type='xmile' or $type='mdl')">
				<xsl:attribute name="href">
					<xsl:value-of select="/ShowPage/Script"/>
					<xsl:text>?f=</xsl:text>
					<xsl:value-of select="@id"/>
					<xsl:text>&amp;m=xmile&amp;param=check&amp;ex=</xsl:text>
					<xsl:value-of select="$thisXsl"/>
				</xsl:attribute>
			</xsl:when>
			<xsl:when test="sTemplate='Xtern'">
				<xsl:attribute name="href">
					<xsl:value-of select="@name"/>
				</xsl:attribute>
				<xsl:if test="$target !=''">
					<xsl:attribute name="target">
						<xsl:value-of select="$target"/>
					</xsl:attribute>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<xsl:attribute name="href">
					<xsl:value-of select="/ShowPage/Script"/>
					<xsl:text>?f=</xsl:text>
					<xsl:value-of select="@id"/>
				</xsl:attribute>
				<xsl:if test="$target !=''">
					<xsl:attribute name="target">
						<xsl:value-of select="$target"/>
					</xsl:attribute>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:if test="$target !=''">
			<xsl:attribute name="target">
				<xsl:value-of select="$target"/>
			</xsl:attribute>
		</xsl:if>
	</xsl:template>
	<xsl:template match="Subobj">
		<xsl:variable name="id" select="@id"/>
		<xsl:choose>
			<xsl:when test="count(../Richtext//img[contains(@src,concat('?f=',$id))]) " />
			<xsl:when test="count(../Richtext//table[@class='ppt'])" />
			<xsl:when test="count(/ShowPage/ListOption/@max) and position() > /ShowPage/ListOption/@max"/>
			<xsl:otherwise>
				<tr valign="top" id="l{@id}">
					<td style="width: 23px; {$tdstyle}">
						<xsl:choose>
							<xsl:when test="sTemplate[.='Empty']">
								<br/>
							</xsl:when>
							<xsl:otherwise>
								<a>
									<xsl:apply-templates select="." mode="link">
										<xsl:with-param name="target" select="../Target" />
									</xsl:apply-templates>
									<img border="0" width="20" height="16" alt="{$lsPageGif}" src="{../ImgDir}DynClose.gif"/>
								</a>
							</xsl:otherwise>
						</xsl:choose>
					</td>
					<td class="under" style="{$tdstyle}">
						<a target="{../Target}" style="text-decoration: none;">
							<xsl:apply-templates select="." mode="link"/>
							<xsl:value-of select="sTitle"/>
						</a>
						<xsl:apply-templates select="." mode="Status"/>
					</td>
				</tr>

			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="ShowPage" mode="append">
		<xsl:if test="count(xmileres) = 0 and (contains(Edit/@link,'m=edit') or contains(Edit/@link,'m=append'))">
			<xsl:call-template name="append"/>
			<xsl:call-template name="append">
				<xsl:with-param name="link">
					<xsl:text>javascript:CreatePage(</xsl:text>
					<xsl:value-of select="@id"/>
					<xsl:text>,'</xsl:text>
					<xsl:apply-templates select="@super" mode="new"/>
					<xsl:text>');</xsl:text>
				</xsl:with-param>
				<xsl:with-param name="title">
					<xsl:value-of select="$lsAppendPageTitle"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>
	<xsl:template name="append">
		<xsl:param name="link" select="''"/>
		<xsl:param name="title" select="''"/>
		<xsl:param name="onclick" select="''" />
		<xsl:param name="link2" select="''" />
		<xsl:param name="title2" select="''" />
		<xsl:param name="link3" select="''" />
		<xsl:param name="title3" select="''" />
		<xsl:param name="link4" select="''" />
		<xsl:param name="title4" select="''" />
		<tr class="appendmenu">
			<xsl:choose>
				<xsl:when test="$title=$lsAppendComplex">
					<script>
						function doit(ctrl){
						var id = <xsl:value-of select="/ShowPage/@id"/>;
						switch(ctrl.selectedIndex){
						case 1: CreatePage(id,'Section.xsl'); break;
						case 2: CreatePage(id,'PrivateFile'); break;
						case 3: CreatePage(id,'Xtern'); break;
						default: ctrl.form.submit();
						}
						}
					</script>
					<td style="width:23px;{$tdstyle}">
						<img border="0" width="20" height="16" alt="{$lsPageGif}" src="{/ShowPage/ImgDir}DynClose.gif"
                            style="vertical-align: top; margin-top: 4px;"/>
					</td>
					<td style="vertical-align: middle; white-space: nowrap;" class="under">
						<form method="get" action="{/ShowPage/SysURL}">
							<xsl:value-of select="$title"/>
							<xsl:text>&#160;</xsl:text>
							<xsl:variable name="color">
								<xsl:choose>
									<xsl:when test="count(/ShowPage/text) = 0">
										<xsl:text>#000000;</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="/ShowPage/text"/>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
							<select name="f" onchange="doit(this);"
                                style="width: 220px; border: 1px #888888 dotted;background-color: transparent;color: {$color} ">
								<option>...</option>
								<option>
									<xsl:value-of select="$lsNewPage"/>
								</option>
								<option>
									<xsl:value-of select="$lsNewFile"/>
								</option>
								<option>
									<xsl:value-of select="$lsNewLink"/>
								</option>
								<xsl:for-each select="/ShowPage/Options/sTemplate[not(contains(@id,'.xsl')) and not(starts-with(.,'--'))]">
									<option value="{@id}">
										<xsl:value-of select="."/>
									</option>
								</xsl:for-each>
							</select>
							<input type="hidden" name="param" value="{/ShowPage/@id}"/>
							<input type="hidden" name="m" value="xcopy"/>
							<input type="hidden" name="next" value="new" />
						</form>
					</td>
				</xsl:when>
				<xsl:when test="$title = $lsAppendPageTitle">
					<xsl:attribute name="id">addcomplex</xsl:attribute>
					<td colspan="2" style="vertical-align: middle; white-space: nowrap;" class="under">
						<script>
							function takexmile(){
							var xmilearea = document.getElementById('xmilearea');
							var xmiletext = document.getElementById('xmiletext');
							var xmiletype = document.getElementById('xmiletype');
							var sNextEdit = document.getElementById('sNextEdit');
							var stitle = document.getElementById('sTitle');
							var stemplate = document.getElementById('sTemplate');
							if(xmilearea.value !=''){
							xmiletext.value = xmilearea.value;
							// #### 16.02.2026 ####
							xmiletext.value = extractFromCodeBlock(xmiletext.value, 'xml');
							xmiletext.value = extractFromCodeBlock(xmiletext.value, 'html');
							// ####################
							// alert(xmiletext.value);
							stemplate.value = 'PrivateFile';
							if(stitle.value == '') stitle.value = '<xsl:value-of select="concat(translate(/ShowPage/sTitle,&quot;'&quot;,'´'),' ',/ShowPage/@now)"/>';
							// alert(xmiletype.value);
							<!--if (xmiletext.value.startsWith('&lt;!DOCTYPE html>')) {
											xmiletype.value='.html';
											sNextEdit.value='<xsl:value-of select="/ShowPage/@id"/>';
											}
										else-->
							if (!(xmiletext.value.startsWith('&lt;?xml ') || xmiletext.value.startsWith('&lt;xmile ') )  ) {
							xmiletype.value='.html';
							if (!(xmiletext.value.includes('&lt;html')))
							xmiletext.value = convertMarkdownToHtml(xmiletext.value);
							sNextEdit.value='<xsl:value-of select="/ShowPage/@id"/>';
							}
							}
							}

							<![CDATA[
							
    function convertMarkdownToHtml(text, wrapDocument) {
      if (!text || text.length === 0) return '';

      let result = text;

      // 1) Escape (Sicherheit!)
      result = escapeHtml(result);

      // 2) Block-level conversions
      result = convertHeadings(result);

      // 3) Horizontal rules (--- on its own line)
      result = convertHorizontalRules(result);

      // 4) Tables (pipe tables)
      const tableState = { tables: [] };
      result = convertTables(result, tableState);

      // 5) Inline conversions (apply to non-table content)
      result = convertInlineMarkdown(result);

      // 6) Line breaks
      result = result.replace(/\n/g, '<br>\n');

      // 7) Re-insert tables (no <br> pollution inside table HTML)
      for (let i = 0; i < tableState.tables.length; i++) {
        const token = `@@TABLE_${i}@@`;
        result = result.replaceAll(token, tableState.tables[i]);
      }

      // Make preview nicer when embedded
      result = `<div class="prose-like">${result}</div>`;

      if (wrapDocument || true) {
        result = '<!doctype html><html><head><meta charset="utf-8"></head><body>' + result + '</body></html>';
      }

      return result;
    }

    /**
     * Inline Markdown conversions (on already-escaped text)
     */
    function convertInlineMarkdown(text) {
      let result = text;

      // Inline-Code (`code`)
      result = result.replace(/`(.+?)`/g, '<code>$1</code>');

      // Links ([text](url))
      result = result.replace(/\[(.+?)\]\((.+?)\)/g, '<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>');

      // Fett (**text**)
      result = result.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>');

      // Kursiv (*text*)
      result = result.replace(/\*(.+?)\*/g, '<em>$1</em>');

      // Durchgestrichen (~~text~~)
      result = result.replace(/~~(.+?)~~/g, '<del>$1</del>');

      return result;
    }

    /**
     * Konvertiert Markdown-Überschriften in HTML
     */
    function convertHeadings(text) {
      let result = text;
      // H6 bis H1
      result = result.replace(/^###### (.+)$/gm, '<h6>$1</h6>');
      result = result.replace(/^##### (.+)$/gm, '<h5>$1</h5>');
      result = result.replace(/^#### (.+)$/gm, '<h4>$1</h4>');
      result = result.replace(/^### (.+)$/gm, '<h3>$1</h3>');
      result = result.replace(/^## (.+)$/gm, '<h2>$1</h2>');
      result = result.replace(/^# (.+)$/gm, '<h1>$1</h1>');
      return result;
    }

    /**
     * Konvertiert Markdown-Horizontale Linien (---) in HTML <hr>
     */
    function convertHorizontalRules(text) {
      let result = text;
      // --- auf einer eigenen Zeile (mit optionalen Leerzeichen)
      result = result.replace(/^\s*-{3,}\s*$/gm, '<hr>');
      return result;
    }

	/**
     * Escaped HTML-Sonderzeichen für Sicherheit
     */
    function escapeHtml(text) {
      let result = text;
      result = result.replace(/&/g, '&amp;');
      result = result.replace(/</g, '&lt;');
      result = result.replace(/>/g, '&gt;');
      result = result.replace(/\"/g, '&quot;');
      return result;
    }

    /**
     * Converts GitHub-style Markdown pipe tables to HTML tables.
     *
     * Table format:
     *   | H1 | H2 |
     *   | --- | --- |
     *   | c1 | c2 |
     *
     * Alignment is supported via :---, ---:, :---:
     *
     * @param {string} text - escaped markdown text
     * @param {{tables: string[]}} state - holds generated table html
     * @returns {string} text with table blocks replaced by tokens
     */
    function convertTables(text, state) {
      const lines = text.split(/\r?\n/);
      const out = [];

      for (let i = 0; i < lines.length; i++) {
        const line = lines[i];
        const next = (i + 1 < lines.length) ? lines[i + 1] : '';

        if (looksLikeTableHeader(line) && isTableSeparator(next)) {
          const headerCells = splitTableRow(line);
          const alignSpecs = splitTableRow(next).map(parseAlignSpec);

          // Normalize alignment array length
          while (alignSpecs.length < headerCells.length) alignSpecs.push('left');

          const bodyRows = [];
          let j = i + 2;
          for (; j < lines.length; j++) {
            const rowLine = lines[j];
            if (!rowLine || rowLine.trim() === '') break;
            if (!rowLine.includes('|')) break;
            if (isTableSeparator(rowLine)) break;
            bodyRows.push(splitTableRow(rowLine));
          }

          const tableHtml = buildTableHtml(headerCells, bodyRows, alignSpecs);
          const token = `@@TABLE_${state.tables.length}@@`;
          state.tables.push(tableHtml);
          out.push(token);

          i = j - 1; // jump
          continue;
        }

        out.push(line);
      }

      return out.join('\n');
    }

    function looksLikeTableHeader(line) {
      if (!line) return false;
      if (!line.includes('|')) return false;
      // Avoid treating lines that are just a single pipe
      const trimmed = line.trim();
      if (trimmed === '|' || trimmed === '||') return false;
      return true;
    }

    function isTableSeparator(line) {
      if (!line) return false;
      // Matches: |---|---|, ---|---, |:---|---:| etc.
      const re = /^\s*\|?\s*(:?-{3,}:?\s*\|\s*)+(:?-{3,}:?)\s*\|?\s*$/;
      return re.test(line);
    }

    function splitTableRow(line) {
      // Remove leading/trailing pipes (optional), then split.
      let s = line.trim();
      if (s.startsWith('|')) s = s.slice(1);
      if (s.endsWith('|')) s = s.slice(0, -1);
      return s.split('|').map(c => c.trim());
    }

    function parseAlignSpec(spec) {
      const s = (spec || '').trim();
      const left = s.startsWith(':');
      const right = s.endsWith(':');
      if (left && right) return 'center';
      if (right) return 'right';
      return 'left';
    }

    function buildTableHtml(headerCells, bodyRows, alignSpecs) {
      const cols = headerCells.length;

      const ths = headerCells.map((c, idx) => {
        const align = alignSpecs[idx] || 'left';
        const content = convertInlineMarkdown(c);
        return `<th style="text-align:${align}">${content}</th>`;
      }).join('');

      const trs = bodyRows.map(row => {
        const normalized = row.slice(0, cols);
        while (normalized.length < cols) normalized.push('');
        const tds = normalized.map((c, idx) => {
          const align = alignSpecs[idx] || 'left';
          const content = convertInlineMarkdown(c);
          return `<td style="text-align:${align}">${content}</td>`;
        }).join('');
        return `<tr>${tds}</tr>`;
      }).join('');

      return `<table class="md-table"><thead><tr>${ths}</tr></thead><tbody>${trs}</tbody></table>`;
    }
						
    /**
        * Extracts content from a markdown code block of the specified type.
        * @param {string} s - The input string containing the code block
        * @param {string} type - The type of code block ('xml' or 'html')
        * @returns {string} - The extracted content or the entire string if no match
        */
    function extractFromCodeBlock0(s, type) {
        if (typeof s !== 'string' || s.length === 0) {
            return s;
        }

        // Pattern to match: anything, then ```type, then content, then ```
        // The pattern allows for optional content before the opening marker
        const regex = new RegExp(`\`\`\`${type}\\s*\\n([\\s\\S]*?)\\n\`\`\``, 'm');
        const match = s.match(regex);

        if (match && match[1]) {
            return match[1];
        }

        // Return entire string if no code block found
        return s;
    }
	function extractFromCodeBlock(s, type) {
		if (typeof s !== 'string' || s.length === 0) {
			return s;
		}

		const trimmed = s.trim();

		// If the whole string does not end with ``` then do not extract
		if (!trimmed.endsWith("```")) {
			return s;
		}

		// Pattern to match: ```type\n ... \n```
		const regex = new RegExp(`\`\`\`${type}\\s*\\n([\\s\\S]*?)\\n\`\`\``, 'm');
		const match = trimmed.match(regex);

		if (match && match[1]) {
			return match[1];
		}

		// Return original string if no proper block found
		return s;
	}
    /**
        * Extracts XML content from a markdown code block.
        * @param {string} s - The input string containing the XML code block
        * @returns {string} - The extracted XML content or the entire string
        */
    function extractXML(s) {
        return extractFromCodeBlock(s, 'xml');
    }

    /**
        * Extracts HTML content from a markdown code block.
        * @param {string} s - The input string containing the HTML code block
        * @returns {string} - The extracted HTML content or the entire string
        */
    function extractHTML(s) {
        return extractFromCodeBlock(s, 'html');
    }							
							
							]]>

						</script>
						<form method="post" action="?f={/ShowPage/@id}&amp;m=create" onsubmit="takexmile();">
							<xsl:variable name="color">
								<xsl:choose>
									<xsl:when test="count(/ShowPage/text) = 0">
										<xsl:text>#000000;</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="/ShowPage/text"/>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:variable>
							<input type="text" name="sTitle" id="sTitle" autofocus="autofocus"
                                style="width: 400px; background-color: transparent;color: {$color}; {$paShadow} "/>
							<xsl:text>&#160;</xsl:text>
							<input type="submit" value="{$lsAppendPageTitle}" style="{$paShadow}"/>
							<input type="hidden" name="f" value="{/ShowPage/@id}"/>
							<input type="hidden" name="m" value="create"/>
							<input type="hidden" name="ex" value="{$thisXsl}"/>
							<input type="hidden" name="sTemplate" id="sTemplate" value="{$thisXsl}"/>
							<input type="hidden" name="bSave" value="bSave"/>
							<input type="hidden" name="sNextEdit" id="sNextEdit" value="newxmile"/>
							<input type="hidden" id="xmiletext" name="xmiletext" />
							<input type="hidden" id="xmiletype" name="xmiletype" value=".xmile" />
						</form>
						<form name="addform" method="post" enctype="multipart/form-data" style="width: 10px;"
                              action="?f={/ShowPage/@id}&amp;m=create&amp;v=PrivateFile&amp;next=Super">
							<div style="display: inline; width: 80px; overflow: hidden;">
								<input type="file" name="sUpload" multiple="multiple"
                                       style="width: 80px; height: 23px;position: relative; left: 0px; top: 0px; z-index: 200;
                                   -moz-opacity:0; filter:alpha(opacity: 0);  opacity: 0;"
                                    onchange="this.form.submit();" size="20" />
								<input type="button" value="{$lsUploadFiles}"
                                    style="position: relative; left: -80px; top: 0px; z-index:100; width: 80px;{$paShadow}"/>
								<input type="hidden" name="ex" value="{$thisXsl}"/>
								<input type="hidden" name="sNextEdit" id="sNextEdit" value="Super"/>
							</div>

						</form>
						<br />
						<textarea id="xmilearea" name="xmilearea" style="width: 670px; height: 200px; {$paShadow} margin-top: 10px;" />
					</td>


				</xsl:when>
				<xsl:when test="$link != ''">
					<td  style="width: 23px; {$tdstyle}">
						<a href="{$link}" onclick="{$onclick}">
							<img border="0" width="20" height="16" alt="{$lsPageGif}" src="{/ShowPage/ImgDir}DynClose.gif"/>
						</a>
					</td>
					<td class="under" style="width: 657px; {$tdstyle}" >
						<a style="text-decoration: none;" href="{$link}" onclick="{$onclick}">
							<xsl:value-of select="$title"/>
						</a>
						<xsl:text>&#160;</xsl:text>
						<xsl:if test="$link2 != ''">
							<xsl:text>|&#160;</xsl:text>
							<a style="text-decoration: none;" href="{$link2}">
								<xsl:value-of select="$title2"/>
							</a>
							<xsl:text>&#160;</xsl:text>
						</xsl:if>
						<xsl:if test="$link3 != ''">
							<xsl:text>|&#160;</xsl:text>
							<a style="text-decoration: none;" href="{$link3}">
								<xsl:value-of select="$title3"/>
							</a>
							<xsl:text>&#160;</xsl:text>
						</xsl:if>
						<xsl:if test="$link4 != ''">
							<xsl:text>|&#160;</xsl:text>
							<a style="text-decoration: none;" href="{$link4}">
								<xsl:value-of select="$title4"/>
							</a>
						</xsl:if>
					</td>
				</xsl:when>
				<xsl:otherwise>
					<td colspan="2" style="{$tdstyle}">
						<hr0 style="height: 0px; width: 250px; margin-left: 0px; margin-right: 428px;"/>
					</td>
				</xsl:otherwise>
			</xsl:choose>
		</tr>
	</xsl:template>
	<xsl:template match="ShowPage" mode="NoTitleAdd">
		<input type="hidden" name="sTemplate" value="{$thisXsl}" />
	</xsl:template>
	<xsl:template match="xmileres">
		<xsl:value-of select="."/>
	</xsl:template>
</xsl:stylesheet>

