| 
									
										
										
										
											2013-02-26 20:13:28 +02:00
										 |  |  | <?xml version="1.0"?> | 
					
						
							|  |  |  | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | 
					
						
							|  |  |  |   <xsl:strip-space elements="*"/> | 
					
						
							|  |  |  |   <xsl:output method="xml" indent="yes"/> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <xsl:template match="/"> | 
					
						
							| 
									
										
										
										
											2013-03-08 20:12:38 +02:00
										 |  |  |     <divelog program="subsurface-import" version="2"> | 
					
						
							| 
									
										
										
										
											2013-03-02 13:10:38 +02:00
										 |  |  |       <settings> | 
					
						
							|  |  |  |         <divecomputerid deviceid="ffffffff"> | 
					
						
							|  |  |  |           <xsl:apply-templates select="/PROFILE/DEVICE|/profile/device"/> | 
					
						
							|  |  |  |         </divecomputerid> | 
					
						
							|  |  |  |       </settings> | 
					
						
							| 
									
										
										
										
											2013-02-26 20:13:28 +02:00
										 |  |  |       <dives> | 
					
						
							|  |  |  | 	      <xsl:apply-templates select="/PROFILE/REPGROUP/DIVE|/profile/repgroup/dive"/> | 
					
						
							|  |  |  |       </dives> | 
					
						
							|  |  |  |     </divelog> | 
					
						
							|  |  |  |   </xsl:template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-02 13:10:38 +02:00
										 |  |  |   <xsl:template match="DEVICE|device"> | 
					
						
							|  |  |  |     <xsl:if test="MODEL|model != ''"> | 
					
						
							|  |  |  |       <xsl:attribute name="model"> | 
					
						
							|  |  |  |         <xsl:value-of select="MODEL|model"/> | 
					
						
							|  |  |  |       </xsl:attribute> | 
					
						
							|  |  |  |     </xsl:if> | 
					
						
							|  |  |  |     <xsl:if test="version|VERSION != ''"> | 
					
						
							|  |  |  |       <xsl:attribute name="serial"> | 
					
						
							|  |  |  |         <xsl:value-of select="VERSION|version"/> | 
					
						
							|  |  |  |       </xsl:attribute> | 
					
						
							|  |  |  |     </xsl:if> | 
					
						
							|  |  |  |   </xsl:template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-26 20:13:28 +02:00
										 |  |  |   <xsl:template match="DIVE|dive"> | 
					
						
							|  |  |  |     <dive> | 
					
						
							|  |  |  |       <xsl:attribute name="date"> | 
					
						
							|  |  |  |         <xsl:for-each select="DATE/YEAR|DATE/MONTH|DATE/DAY|date/year|date/month|date/day"> | 
					
						
							|  |  |  |           <xsl:if test="position() != 1">-</xsl:if> | 
					
						
							|  |  |  |           <xsl:value-of select="."/> | 
					
						
							|  |  |  |         </xsl:for-each> | 
					
						
							|  |  |  |       </xsl:attribute> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       <xsl:attribute name="time"> | 
					
						
							|  |  |  |         <xsl:for-each select="TIME/HOUR|TIME/MINUTE|time/hour|time/minute"> | 
					
						
							|  |  |  |           <xsl:if test="position() != 1">:</xsl:if> | 
					
						
							|  |  |  |           <xsl:value-of select="."/> | 
					
						
							|  |  |  |         </xsl:for-each> | 
					
						
							|  |  |  |       </xsl:attribute> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       <location> | 
					
						
							|  |  |  |         <xsl:value-of select="PLACE|place"/> | 
					
						
							|  |  |  |       </location> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       <xsl:if test="TEMPERATURE|temperature != ''"> | 
					
						
							|  |  |  |         <temperature> | 
					
						
							|  |  |  |           <xsl:attribute name="water"> | 
					
						
							|  |  |  |             <xsl:value-of select="concat(TEMPERATURE|temperature, ' C')"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </temperature> | 
					
						
							|  |  |  |       </xsl:if> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-02 13:10:38 +02:00
										 |  |  |       <divecomputer deviceid="ffffffff"> | 
					
						
							|  |  |  |         <xsl:attribute name="model"> | 
					
						
							|  |  |  |           <xsl:value-of select="/PROFILE/DEVICE/MODEL|/profile/device/model"/> | 
					
						
							|  |  |  |         </xsl:attribute> | 
					
						
							|  |  |  |       </divecomputer> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-26 20:13:28 +02:00
										 |  |  |       <xsl:for-each select="GASES/MIX|gases/mix"> | 
					
						
							|  |  |  |         <cylinder> | 
					
						
							|  |  |  |           <xsl:attribute name="description"> | 
					
						
							|  |  |  |             <xsl:value-of select="MIXNAME|mixname"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |           <xsl:attribute name="size"> | 
					
						
							|  |  |  |             <xsl:value-of select="concat(TANK/TANKVOLUME|tank/tankvolume, ' l')"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |           <xsl:attribute name="start"> | 
					
						
							|  |  |  |             <xsl:value-of select="TANK/PSTART|tank/pstart"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |           <xsl:attribute name="end"> | 
					
						
							|  |  |  |             <xsl:value-of select="TANK/PEND|tank/pend"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |           <xsl:attribute name="o2"> | 
					
						
							|  |  |  |             <xsl:value-of select="O2|o2"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |           <xsl:attribute name="he"> | 
					
						
							|  |  |  |             <xsl:value-of select="HE|he"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </cylinder> | 
					
						
							|  |  |  |       </xsl:for-each> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-11 09:40:40 +08:00
										 |  |  |       <xsl:choose> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<!-- samples recorded at irregular internal, but storing time stamp --> | 
					
						
							|  |  |  | 	<xsl:when test="timedepthmode"> | 
					
						
							| 
									
										
										
										
											2015-12-27 09:07:02 +02:00
										 |  |  |           <xsl:variable name="timeconvert"> | 
					
						
							|  |  |  |             <xsl:choose> | 
					
						
							|  |  |  |               <xsl:when test="//units = 'si'"> | 
					
						
							|  |  |  |                 <xsl:value-of select="60"/> | 
					
						
							|  |  |  |               </xsl:when> | 
					
						
							|  |  |  |               <xsl:otherwise> | 
					
						
							|  |  |  |                 <xsl:value-of select="1"/> | 
					
						
							|  |  |  |               </xsl:otherwise> | 
					
						
							|  |  |  |             </xsl:choose> | 
					
						
							|  |  |  |           </xsl:variable> | 
					
						
							|  |  |  |           <debug name="{$timeconvert}"/> | 
					
						
							| 
									
										
										
										
											2014-11-11 09:40:40 +08:00
										 |  |  | 	  <!-- gas change --> | 
					
						
							|  |  |  | 	  <xsl:for-each select="SAMPLES/SWITCH|samples/switch"> | 
					
						
							|  |  |  | 	    <event name="gaschange"> | 
					
						
							|  |  |  | 	      <xsl:variable name="timeSec" select="following-sibling::T|following-sibling::t"/> | 
					
						
							|  |  |  | 	      <xsl:attribute name="time"> | 
					
						
							| 
									
										
										
										
											2015-12-27 09:07:02 +02:00
										 |  |  | 		<xsl:value-of select="concat(floor($timeSec div $timeconvert), ':', | 
					
						
							|  |  |  | 		  format-number(floor($timeSec mod $timeconvert), '00'), ' min')"/> | 
					
						
							| 
									
										
										
										
											2014-11-11 09:40:40 +08:00
										 |  |  | 	      </xsl:attribute> | 
					
						
							|  |  |  | 	      <xsl:attribute name="value"> | 
					
						
							|  |  |  | 		<xsl:value-of select="ancestor::DIVE/GASES/MIX[MIXNAME=current()]/O2|ancestor::dive/gases/mix[mixname=current()]/o2 * 100" /> | 
					
						
							|  |  |  | 	      </xsl:attribute> | 
					
						
							|  |  |  | 	    </event> | 
					
						
							|  |  |  | 	  </xsl:for-each> | 
					
						
							|  |  |  | 	  <!-- end gas change --> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	  <!-- samples --> | 
					
						
							|  |  |  | 	  <xsl:for-each select="SAMPLES/D|samples/d"> | 
					
						
							|  |  |  | 	    <sample> | 
					
						
							|  |  |  | 	      <xsl:variable name="timeSec" select="preceding-sibling::T[position()=1]|preceding-sibling::t[position()=1]"/> | 
					
						
							|  |  |  | 	      <xsl:attribute name="time"> | 
					
						
							| 
									
										
										
										
											2015-12-27 09:07:02 +02:00
										 |  |  | 		<xsl:value-of select="concat(floor($timeSec div $timeconvert), ':', | 
					
						
							|  |  |  | 		  format-number(floor($timeSec mod $timeconvert), '00'), ' min')"/> | 
					
						
							| 
									
										
										
										
											2014-11-11 09:40:40 +08:00
										 |  |  | 	      </xsl:attribute> | 
					
						
							|  |  |  | 	      <xsl:attribute name="depth"> | 
					
						
							|  |  |  | 		<xsl:value-of select="concat(., ' m')"/> | 
					
						
							|  |  |  | 	      </xsl:attribute> | 
					
						
							|  |  |  | 	    </sample> | 
					
						
							|  |  |  | 	  </xsl:for-each> | 
					
						
							|  |  |  | 	  <!-- end samples --> | 
					
						
							|  |  |  | 	</xsl:when> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	<!-- sample recorded at even internals --> | 
					
						
							|  |  |  | 	<xsl:otherwise> | 
					
						
							|  |  |  | 	  <xsl:variable name="delta" select="SAMPLES/DELTA|samples/delta"/> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	  <!-- gas change --> | 
					
						
							|  |  |  | 	  <xsl:for-each select="SAMPLES/SWITCH|samples/switch"> | 
					
						
							|  |  |  | 	    <event name="gaschange"> | 
					
						
							|  |  |  | 	      <xsl:variable name="timeSec" select="count(preceding-sibling::D|preceding-sibling::d) * $delta"/> | 
					
						
							|  |  |  | 	      <xsl:attribute name="time"> | 
					
						
							|  |  |  | 		<xsl:value-of select="concat(floor($timeSec div 60), ':', | 
					
						
							|  |  |  | 		  format-number(floor($timeSec mod 60), '00'), ' min')"/> | 
					
						
							|  |  |  | 	      </xsl:attribute> | 
					
						
							|  |  |  | 	      <xsl:attribute name="value"> | 
					
						
							|  |  |  | 		<xsl:value-of select="ancestor::DIVE/GASES/MIX[MIXNAME=current()]/O2|ancestor::dive/gases/mix[mixname=current()]/o2 * 100" /> | 
					
						
							|  |  |  | 	      </xsl:attribute> | 
					
						
							|  |  |  | 	    </event> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	  </xsl:for-each> | 
					
						
							|  |  |  | 	  <!-- end gas change --> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	  <!-- samples --> | 
					
						
							|  |  |  | 	  <xsl:for-each select="SAMPLES/D|samples/d"> | 
					
						
							|  |  |  | 	    <sample> | 
					
						
							|  |  |  | 	      <xsl:variable name="timeSec" select="(position() - 1) * $delta"/> | 
					
						
							|  |  |  | 	      <xsl:attribute name="time"> | 
					
						
							|  |  |  | 		<xsl:value-of select="concat(floor($timeSec div 60), ':', | 
					
						
							|  |  |  | 		  format-number(floor($timeSec mod 60), '00'), ' min')"/> | 
					
						
							|  |  |  | 	      </xsl:attribute> | 
					
						
							|  |  |  | 	      <xsl:attribute name="depth"> | 
					
						
							|  |  |  | 		<xsl:value-of select="concat(., ' m')"/> | 
					
						
							|  |  |  | 	      </xsl:attribute> | 
					
						
							|  |  |  | 	    </sample> | 
					
						
							|  |  |  | 	  </xsl:for-each> | 
					
						
							|  |  |  | 	  <!-- end samples --> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	</xsl:otherwise> | 
					
						
							|  |  |  |       </xsl:choose> | 
					
						
							| 
									
										
										
										
											2013-02-26 20:13:28 +02:00
										 |  |  |     </dive> | 
					
						
							|  |  |  |   </xsl:template> | 
					
						
							|  |  |  | </xsl:stylesheet> |