<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/xsl' href='#'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:TranslationData="http://www.autodesk.com/Inventor/Translation">
	<!-- Autodesk Inventor Translation Report XML data -->
	<TranslationData:data>
		<TranslationResults><Date>mercredi 15 février 2012</Date><Time>16:45</Time><TranslationTime>2334</TranslationTime><Input><Options><ImportElements><ImportElement>Solids</ImportElement><ImportElement>Surfaces</ImportElement><ImportElement>Wires</ImportElement></ImportElements><StitchAndPromote>On</StitchAndPromote><QualityCheck>Off</QualityCheck><Destination>Composite</Destination><ConstructionGroupMapping><GroupDataPlacement>Multiple</GroupDataPlacement><GroupCreationMethod>Levels</GroupCreationMethod></ConstructionGroupMapping></Options><File><FullPath>C:\Users\Dominique\Documents\travail\travail maison\année 2011-2012\STI2D\prépa activités\projet 2\r067201200.igs</FullPath><Type>IGES</Type></File><SendingSystem>Pro/ENGINEER by Parametric Technology Corporation</SendingSystem><Units>MM</Units><Author>PRK2-ELT</Author></Input><Output><File><Filename>r067201200</Filename><FullPath>C:\Users\Dominique\Documents\travail\travail maison\année 2011-2012\STI2D\prépa activités\projet 2\r067201200.ipt</FullPath><Type>Part</Type></File></Output></TranslationResults></TranslationData:data>
	<!-- Autodesk Inventor Translation Report XSL -->
	<xsl:template match="xsl:stylesheet">
		<xsl:apply-templates select="TranslationData:data"/>
	</xsl:template>
	<!-- Global Variables -->
	<xsl:variable name="report-width">900</xsl:variable>
	<xsl:variable name="plus-minus-col-width">7%</xsl:variable>
	<xsl:template match="TranslationResults">
		<html>
			<head>
				<!-- CSS Formatting -->
				<title>Rapport de conversion d'Autodesk Inventor</title>
				<style type="text/css">
					body 	{	background-color: white; color: black; font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; font-weight: normal; text-align: left; text-indent: 0pt; margin-bottom: 0pt; margin-left: 12pt; margin-right: 12pt; margin-top: 6pt;	}
					th	{	font-size: 12pt; font-weight: bold; margin-top: 12pt; margin-bottom: 3pt; text-align: left; background-color: #bbbbbb;	}
					td {	font-size: 10pt; font-weight: normal; margin-top: 12pt; margin-bottom: 3pt;	}
					table table th { font-size: 10pt; font-weight: bold; margin-top: 10pt; margin-bottom: 3pt; text-align: left; background-color:#eeeeee; }
					table table td {	font-size: 10pt; font-weight: normal; margin-top: 12pt; margin-bottom: 3pt;	}
					tr.row-style0 {	background-color: #ddddff;	}
					tr.row-style1 {	background-color: #eeeeff;	}
					.title 	{	color: #003399; font-size: 14pt; font-weight: bold;	}
					.header-heading {	font-weight: bold;	}
					.section-heading	{ color: #003399; font-size: 12pt; font-weight: bold; margin-top: 12pt; margin-bottom: 8pt;	}
					.table-description	{ margin-top: 6pt; margin-bottom: 3pt;	}
					.timestamp {	font-size: 9pt; font-weight: normal; color: #003399; text-align: right;	}
					.plus-minus {	text-align: center; font-family: monospace; font-weight: bold; cursor: pointer; cursor: hand; }
					.status-error {	color: CC0000; font-weight: bold;	}
					.status-warning {	color: #999900; font-weight: bold;	}
					.status-message {	color: #003366; font-weight: bold;	}
					.status-unknown {	color: #660066; font-weight: bold;	}
					.status-debug	{	color: #660066; font-weight: bold;	}					
					.status-success {	color: #006600;	}
				</style>
				<!-- Javascript -->
				<script language="JavaScript" type="text/javascript">
					function setDisplay(id, displayStyle)
					{
						el = document.getElementById(id)
						if (el != null)
							el.style.display = displayStyle;
					}
	
					function hide(id)
					{
						setDisplay(id, "none");
					}
	
					function show(id)
					{
						setDisplay(id, "");
					}
	
					function Expand(row, prefix)
					{
						hide(prefix + "plus" + row);
						show(prefix + "minus" + row);
						show(prefix + "details" + row);
					}
	
					function Collapse(row, prefix)
					{
						show(prefix + "plus" + row);
						hide(prefix + "minus" + row);
						hide(prefix + "details" + row);
					}

					function ChangeAll(fnChange, prefix)
					{
						row = 1;
						while(document.getElementById(prefix + "row" + row) != null)
							fnChange(row++, prefix);
					}
	
					function ExpandAll(prefix)
					{
						ChangeAll(Expand, prefix);
					}
	
					function CollapseAll(prefix)
					{
						ChangeAll(Collapse, prefix);
					}

				</script>
			</head>
			<body>
				<!-- Title & timestamp -->
				<table border="0" width="{$report-width}">
					<tr>
						<td><h1 class="title">Rapport de conversion d'Autodesk Inventor</h1></td>
						<td class="timestamp"><xsl:value-of select="Date"/> (<xsl:value-of select="Time"/>)</td>
					</tr>
				</table>
				<!-- Input data -->
				<table border="0" width="{$report-width}">
					<col width="15%"/><col width="35%"/><col width="25%"/><col width="25%"/>
					<tr>
						<td class="header-heading">Fichier sélectionné:</td>
						<td colspan="3"><xsl:value-of select="Input/File/FullPath"/></td>
					</tr>
					<tr>
						<td class="header-heading">Type de conversion:</td>
						<td>
							<xsl:choose>
								<xsl:when test="Input/File/Type='IGES'">IGES</xsl:when>
								<xsl:when test="Input/File/Type='STEP'">STEP</xsl:when>
								<xsl:otherwise>Inconnu</xsl:otherwise>
							</xsl:choose>
						</td>
						<td class="header-heading">Entités à importer: </td>
						<td>
							<xsl:apply-templates select="Input/Options/ImportElements/ImportElement"/>
						</td>
					</tr>
					<tr>
						<td class="header-heading">Durée de la conversion:</td>
						<td>
							<xsl:call-template name="format-elapsed-time">
								<xsl:with-param name="milliseconds" select="translate(TranslationTime, ',', '')"/>
							</xsl:call-template>
						</td>
						<td class="header-heading">Couture et intégration automatiques: </td>
						<td>
							<xsl:call-template name="on-off-option-string">
								<xsl:with-param name="option" select="Input/Options/StitchAndPromote"/>
							</xsl:call-template>
						</td>
					</tr>
					<tr>
						<td class="header-heading">Système expéditeur: </td>
						<td><xsl:value-of select="Input/SendingSystem"/></td>
						<td class="header-heading">Vérifier les pièces lors de l'importation: </td>
						<td>
							<xsl:call-template name="on-off-option-string">
								<xsl:with-param name="option" select="Input/Options/QualityCheck"/>
							</xsl:call-template>
						</td>
					</tr>
					<tr>
						<td class="header-heading">Unités: </td>
						<td><xsl:value-of select="Input/Units"/></td>
						<td class="header-heading">Correspondance du groupe de construction: </td>
						<td>
							<xsl:variable name="group-data-placement" select="Input/Options/ConstructionGroupMapping/GroupDataPlacement"/>
							<xsl:choose>
								<xsl:when test="$group-data-placement = 'Single'">Groupe unique</xsl:when>
								<xsl:when test="$group-data-placement = 'Multiple'">Groupes multiples</xsl:when>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td class="header-heading">Auteur: </td>
						<td><xsl:value-of select="Input/Author"/></td>
						<td class="header-heading">Destination: </td>
						<td>
							<xsl:variable name="destination" select="Input/Options/Destination"/>
							<xsl:choose>
								<xsl:when test="$destination = 'Composite'">Composite</xsl:when>
								<xsl:when test="$destination = 'Construction'">Construction</xsl:when>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td colspan="2"/>
						<xsl:choose>
							<xsl:when test="Input/Options/ConstructionGroupMapping/GroupName">
								<td>     <span class="header-heading">Nom du groupe: </span></td>
								<td><xsl:value-of select="Input/Options/ConstructionGroupMapping/GroupName"/></td>
							</xsl:when>
							<xsl:when test="Input/Options/ConstructionGroupMapping/GroupCreationMethod">
								<td>     <span class="header-heading">Groupes à partir de: </span></td>
								<td>
									<xsl:variable name="groups-from" select="Input/Options/ConstructionGroupMapping/GroupCreationMethod"/>
									<xsl:choose>
										<xsl:when test="$groups-from = 'Levels'">Niveaux</xsl:when>
										<xsl:when test="$groups-from = 'Groups'">Groupes</xsl:when>
									</xsl:choose>
								</td>
							</xsl:when>
							<xsl:otherwise><td colspan="2"/></xsl:otherwise>
						</xsl:choose>
					</tr>
					<xsl:if test="Input/Options/ConstructionGroupMapping/GroupNamePrefix">
						<tr>
							<td colspan="2"/>
							<td>     <span class="header-heading">Préfixe du nom du groupe: </span></td>
							<td><xsl:value-of select="Input/Options/ConstructionGroupMapping/GroupNamePrefix"/></td>
						</tr>
					</xsl:if>
				</table>
				<xsl:apply-templates select="Output"/>
				<p/>
			</body>
		</html>
	</xsl:template>
	<!-- Lists import elements (Solids, Wires, Surfaces) with comma separator -->
	<xsl:template match="TranslationResults/Input/Options/ImportElements/ImportElement">
		<xsl:variable name="import-element" select="."/>
		<xsl:choose>
			<xsl:when test="$import-element = 'Solids'">Solides</xsl:when>
			<xsl:when test="$import-element = 'Wires'">Fils</xsl:when>
			<xsl:when test="$import-element = 'Surfaces'">Surfaces</xsl:when>
		</xsl:choose>
		<xsl:if test="position() != last()">, </xsl:if>
	</xsl:template>
	<!-- Output data -->
	<xsl:template match="TranslationResults/Output">
		<xsl:call-template name="component-table"/>
		<xsl:apply-templates select="Miscellaneous"/>
	</xsl:template>
	<!-- Generate the "Component" section -->
	<xsl:template name="component-table">
		<xsl:variable name="component-expand-collapse-id" select="'component-'"/>
		<h2 class="section-heading">Composants</h2>
		<p class="table-description">La table suivante répertorie les pièces et ensembles créés dans Inventor:</p>
		<table border="0" width="{$report-width}">
			<col width="{$plus-minus-col-width}"/>
			<tr>
				<th>
					<xsl:call-template name="plus-minus-all">
						<xsl:with-param name="expand-collapse-id" select="$component-expand-collapse-id"/>
					</xsl:call-template>
				</th>
				<th>Nom</th>
				<th>Fichier Inventor</th>
				<th>Etat</th>
			</tr>
			<xsl:apply-templates select="File">
				<xsl:with-param name="expand-collapse-id" select="$component-expand-collapse-id"/>
			</xsl:apply-templates>
		</table>
	</xsl:template>
	<!-- Generate a table row for a file -->
	<xsl:template match="File">
		<xsl:param name="expand-collapse-id" select="'expand-collapse-default'"/>
		<xsl:variable name="row" select="position()"/>
		<xsl:variable name="row-odd-even" select="$row mod 2"/>
		<tr id="{$expand-collapse-id}row{$row}" class="row-style{$row-odd-even}">
			<td>
				<xsl:call-template name="plus-minus-item">
					<xsl:with-param name="expand-collapse-id" select="$expand-collapse-id"/>
					<xsl:with-param name="row" select="$row"/>
					<xsl:with-param name="expand-test" select="AsmResults"/>
				</xsl:call-template>
			</td>
			<td><xsl:value-of select="Filename"/></td>
			<td>
				<a>
					<xsl:attribute name="href"><xsl:value-of select="FullPath"/></xsl:attribute>
					<xsl:value-of select="FullPath"/>
				</a>
			</td>
			<td>
				<xsl:call-template name="asm-severity"/>
			</td>
		</tr>
		<xsl:if test="AsmResults">
			<tr id="{$expand-collapse-id}details{$row}" style="display: none">
				<xsl:apply-templates select="AsmResults"/>
			</tr>
		</xsl:if>
	</xsl:template>
	<!-- Generate the "Miscellaneous" section (if there are any miscellaneous items) -->
	<xsl:template match="Miscellaneous">
		<xsl:variable name="misc-expand-collapse-id" select="'misc-'"/>
		<h2 class="section-heading">Divers</h2>
		<table border="0" width="{$report-width}">
			<col width="{$plus-minus-col-width}"/>
			<tr>
				<th>
					<xsl:call-template name="plus-minus-all">
						<xsl:with-param name="expand-collapse-id" select="$misc-expand-collapse-id"/>
					</xsl:call-template>
				</th>
				<th>Divers résultats de la conversion</th>
			</tr>
			<xsl:call-template name="misc-asm-results">
				<xsl:with-param name="expand-collapse-id" select="$misc-expand-collapse-id"/>
			</xsl:call-template>
		</table>
	</xsl:template>
	<!-- Generate a table for a collection ASM results under the Miscellaneous heading -->
	<xsl:template name="misc-asm-results">
		<xsl:param name="expand-collapse-id" select="'expand-collapse-default'"/>
		<xsl:variable name="row" select="1"/>
		<xsl:variable name="row-odd-even" select="$row mod 2"/>
		<tr id="{$expand-collapse-id}row{$row}" class="row-style{$row-odd-even}">
			<td>
				<xsl:call-template name="plus-minus-item">
					<xsl:with-param name="expand-collapse-id" select="$expand-collapse-id"/>
					<xsl:with-param name="row" select="$row"/>
					<xsl:with-param name="expand-test" select="AsmResults"/>
				</xsl:call-template>
			</td>
			<td>Résultats d'Autodesk Shape Manager</td>
		</tr>
		<xsl:if test="AsmResults">
			<tr id="{$expand-collapse-id}details{$row}" style="display: none">
				<xsl:apply-templates select="AsmResults"/>
			</tr>
		</xsl:if>
	</xsl:template>
	<!-- Generate a table for a collection of ASM results -->
	<xsl:template match="AsmResults">
		<td/>
		<td colspan="3">
			<table border="1" width="100%">
				<col width="15%"/><col width="10%"/><col width="75%"/>
				<tr>
					<th>Gravité</th>
					<th>Identificateur d'entité</th>
					<th>Message</th>
				</tr>
				<xsl:apply-templates select="AsmResult"/>
			</table>
			<p/>
		</td>
	</xsl:template>
	<!-- Generate a single table row for an ASM result -->
	<xsl:template match="AsmResult">
		<tr>
			<td>
				<xsl:call-template name="severity-string">
					<xsl:with-param name="severity" select="@Severity"/>
				</xsl:call-template>
			</td>
			<td><xsl:value-of select="translate(@EntityId, ',', '')"/></td>
			<td><xsl:value-of select="."/></td>
		</tr>
	</xsl:template>
	<!-- Generates top level +/- for "Expand All" and "Collapse All" functionality -->
	<xsl:template name="plus-minus-all">
		<xsl:param name="expand-collapse-id" select="'expand-collapse-default'"/>
		<div class="plus-minus">
			<span onclick="ExpandAll('{$expand-collapse-id}')">+</span>
			<span>/</span>
			<span onclick="CollapseAll('{$expand-collapse-id}')">-</span>
		</div>
	</xsl:template>
	<!-- Generates [+], [-], or [ ] for expandable rows depending on if the row is collapsed, expanded, or not expandable, respectively -->
	<xsl:template name="plus-minus-item">
		<xsl:param name="expand-collapse-id" select="'expand-collapse-default'"/>
		<xsl:param name="expand-test" select="false()"/>
		<xsl:param name="row" select="1"/>
		<xsl:choose>
			<xsl:when test="$expand-test">
				<div onclick="Expand({$row}, '{$expand-collapse-id}')" id="{$expand-collapse-id}plus{$row}" class="plus-minus">[+]</div>
				<div onclick="Collapse({$row}, '{$expand-collapse-id}')" id="{$expand-collapse-id}minus{$row}" class="plus-minus" style="display: none">[-]</div>
			</xsl:when>
			<xsl:otherwise>
				<div class="plus-minus">[ ]</div>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- Gets localized ASM severity string based on XML, or outputs success string if no ASM errors -->
	<xsl:template name="asm-severity">
		<xsl:choose>
			<xsl:when test="AsmResults">
				<xsl:call-template name="severity-string">
					<xsl:with-param name="severity" select="AsmResults/AsmResult/@Severity"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise><div class="status-success">Réussite</div></xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- Gets localized severity string based on XML severity string -->
	<xsl:template name="severity-string">
		<xsl:param name="severity" select="'Unknown'"/>
		<xsl:choose>
			<xsl:when test="$severity = 'Error'"><div class="status-error">Erreur</div></xsl:when>
			<xsl:when test="$severity = 'Warning'"><div class="status-warning">Avertissement</div></xsl:when>
			<xsl:when test="$severity = 'Message'"><div class="status-message">Message</div></xsl:when>
			<xsl:when test="$severity = 'Debug'"><div class="status-debug">Déboguer</div></xsl:when>
			<xsl:otherwise><div class="status-unknown">Inconnu</div></xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- Formats time into format H:M:S:ms -->
	<xsl:template name="format-elapsed-time">
		<xsl:param name="milliseconds" select="0.0"/>
		<xsl:variable name="milliseconds-remainder" select="floor($milliseconds mod 1000)"/>
		<xsl:variable name="seconds" select="$milliseconds div 1000"/>
		<xsl:variable name="seconds-remainder" select="floor($seconds mod 60)"/>
		<xsl:variable name="minutes" select="floor($seconds div 60)"/>
		<xsl:variable name="minutes-remainder" select="floor($minutes mod 60)"/>
		<xsl:variable name="hours" select="floor($minutes div 60)"/>
		<xsl:number value="$hours" format="01"/>
		<xsl:number value="$minutes-remainder" format=":01"/>
		<xsl:number value="$seconds-remainder" format=":01"/>
		<xsl:number value="$milliseconds-remainder" format=":001"/>
	</xsl:template>
	<!-- Converts "On"/"Off" xml into "Yes"/"No" strings -->
	<xsl:template name="on-off-option-string">
		<xsl:param name="option"/>
		<xsl:choose>
			<xsl:when test="$option = 'On'">Oui</xsl:when>
			<xsl:when test="$option = 'Off'">Non</xsl:when>
			<xsl:otherwise>Unknown</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
