| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  | <?xml version="1.0"?> | 
					
						
							|  |  |  | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | 
					
						
							|  |  |  |   <xsl:include href="commonTemplates.xsl"/> | 
					
						
							|  |  |  |   <xsl:strip-space elements="*"/> | 
					
						
							|  |  |  |   <xsl:param name="separatorIndex" select="separatorIndex"/> | 
					
						
							|  |  |  |   <xsl:param name="units" select="units"/> | 
					
						
							|  |  |  |   <xsl:output method="xml" encoding="utf-8" indent="yes"/> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <xsl:variable name="lf"><xsl:text> | 
					
						
							|  |  |  | </xsl:text></xsl:variable> | 
					
						
							|  |  |  |   <xsl:variable name="fs"> | 
					
						
							|  |  |  |     <xsl:choose> | 
					
						
							|  |  |  |       <xsl:when test="$separatorIndex = 0"><xsl:text>	</xsl:text></xsl:when> | 
					
						
							|  |  |  |       <xsl:when test="$separatorIndex = 2"><xsl:text>;</xsl:text></xsl:when> | 
					
						
							|  |  |  |       <xsl:otherwise><xsl:text>,</xsl:text></xsl:otherwise> | 
					
						
							|  |  |  |     </xsl:choose> | 
					
						
							|  |  |  |   </xsl:variable> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <xsl:template match="/"> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |     <xsl:variable name="cylinders"> | 
					
						
							|  |  |  |       <xsl:call-template name="countCylinders"> | 
					
						
							| 
									
										
										
										
											2020-05-23 19:41:00 +03:00
										 |  |  |         <xsl:with-param name="line" select="substring-before(//SubsurfaceCSV, $lf)"/> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |         <xsl:with-param name="count" select="'0'"/> | 
					
						
							|  |  |  |         <xsl:with-param name="index" select="'10'"/> | 
					
						
							|  |  |  |       </xsl:call-template> | 
					
						
							|  |  |  |     </xsl:variable> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |     <divelog program="subsurface-import" version="2"> | 
					
						
							|  |  |  |       <dives> | 
					
						
							|  |  |  |         <xsl:call-template name="printLine"> | 
					
						
							|  |  |  |           <xsl:with-param name="line" select="substring-before(substring-after(//SubsurfaceCSV, $lf), $lf)"/> | 
					
						
							|  |  |  |           <xsl:with-param name="remaining" select="substring-after(substring-after(//SubsurfaceCSV, $lf), $lf)"/> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |           <xsl:with-param name="cylinders" select="$cylinders"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |         </xsl:call-template> | 
					
						
							|  |  |  |       </dives> | 
					
						
							|  |  |  |     </divelog> | 
					
						
							|  |  |  |   </xsl:template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <xsl:template name="printLine"> | 
					
						
							|  |  |  |     <xsl:param name="line"/> | 
					
						
							|  |  |  |     <xsl:param name="remaining"/> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |     <xsl:param name="cylinders"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     <xsl:call-template name="printFields"> | 
					
						
							|  |  |  |       <xsl:with-param name="line" select="$line"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:23 +02:00
										 |  |  |       <xsl:with-param name="remaining" select="$remaining"/> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |       <xsl:with-param name="cylinders" select="$cylinders"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |     </xsl:call-template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <xsl:if test="$remaining != ''"> | 
					
						
							|  |  |  |       <xsl:call-template name="printLine"> | 
					
						
							|  |  |  |         <xsl:with-param name="line" select="substring-before($remaining, $lf)"/> | 
					
						
							|  |  |  |         <xsl:with-param name="remaining" select="substring-after($remaining, $lf)"/> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |         <xsl:with-param name="cylinders" select="$cylinders"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |       </xsl:call-template> | 
					
						
							|  |  |  |     </xsl:if> | 
					
						
							|  |  |  |   </xsl:template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <xsl:template name="printFields"> | 
					
						
							|  |  |  |     <xsl:param name="line"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:23 +02:00
										 |  |  |     <xsl:param name="remaining"/> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |     <xsl:param name="cylinders"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:23 +02:00
										 |  |  |     <xsl:variable name="number"> | 
					
						
							|  |  |  |       <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |         <xsl:with-param name="index" select="0"/> | 
					
						
							|  |  |  |         <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |       </xsl:call-template> | 
					
						
							|  |  |  |     </xsl:variable> | 
					
						
							|  |  |  |     <xsl:if test="$number >= 0"> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |       <dive> | 
					
						
							|  |  |  |         <xsl:attribute name="date"> | 
					
						
							|  |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |             <xsl:with-param name="index" select="1"/> | 
					
						
							|  |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |         </xsl:attribute> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:attribute name="time"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |             <xsl:with-param name="index" select="2"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         </xsl:attribute> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <xsl:attribute name="number"> | 
					
						
							|  |  |  |           <xsl:value-of select="$number"/> | 
					
						
							|  |  |  |         </xsl:attribute> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <xsl:attribute name="duration"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |             <xsl:with-param name="index" select="3"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         </xsl:attribute> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:02:12 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |         <!-- If reading of SAC is added at some point, it is already available in our own CSV import --> | 
					
						
							|  |  |  |         <xsl:variable name="sac"> | 
					
						
							|  |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |             <xsl:with-param name="index" select="4"/> | 
					
						
							|  |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							|  |  |  |         <xsl:attribute name="sac"> | 
					
						
							|  |  |  |           <xsl:choose> | 
					
						
							|  |  |  |             <xsl:when test="$units = 1"> | 
					
						
							|  |  |  |               <xsl:value-of select="format-number($sac * 0.035315, '#.##')"/> | 
					
						
							|  |  |  |             </xsl:when> | 
					
						
							|  |  |  |             <xsl:otherwise> | 
					
						
							|  |  |  |               <xsl:value-of select="$sac"/> | 
					
						
							|  |  |  |             </xsl:otherwise> | 
					
						
							|  |  |  |           </xsl:choose> | 
					
						
							|  |  |  |         </xsl:attribute> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:attribute name="tags"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:22:36 +03:00
										 |  |  |             <xsl:with-param name="index" select="24 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         </xsl:attribute> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <xsl:variable name="rating"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:22:36 +03:00
										 |  |  |             <xsl:with-param name="index" select="20 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:if test="$rating != ''"> | 
					
						
							|  |  |  |           <xsl:attribute name="rating"> | 
					
						
							|  |  |  |             <xsl:value-of select="$rating"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:variable name="visibility"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:22:36 +03:00
										 |  |  |             <xsl:with-param name="index" select="21 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:if test="$visibility != ''"> | 
					
						
							|  |  |  |           <xsl:attribute name="visibility"> | 
					
						
							|  |  |  |             <xsl:value-of select="$visibility"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-24 17:29:02 +03:00
										 |  |  |         <divecomputer deviceid="ffffffff" model="SubsurfaceCSV"> | 
					
						
							|  |  |  |           <xsl:attribute name="dctype"> | 
					
						
							|  |  |  |             <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |               <xsl:with-param name="index" select="7"/> | 
					
						
							|  |  |  |               <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |             </xsl:call-template> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </divecomputer> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         <depth> | 
					
						
							|  |  |  |           <xsl:variable name="max"> | 
					
						
							|  |  |  |             <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:22:36 +03:00
										 |  |  |               <xsl:with-param name="index" select="5"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |               <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |             </xsl:call-template> | 
					
						
							|  |  |  |           </xsl:variable> | 
					
						
							|  |  |  |           <xsl:variable name="mean"> | 
					
						
							|  |  |  |             <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:22:36 +03:00
										 |  |  |               <xsl:with-param name="index" select="6"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |               <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |             </xsl:call-template> | 
					
						
							|  |  |  |           </xsl:variable> | 
					
						
							|  |  |  |           <xsl:if test="$max != ''"> | 
					
						
							|  |  |  |             <xsl:attribute name="max"> | 
					
						
							|  |  |  |               <xsl:choose> | 
					
						
							|  |  |  |                 <xsl:when test="$units = 0"> | 
					
						
							|  |  |  |                   <xsl:value-of select="$max"/> | 
					
						
							|  |  |  |                 </xsl:when> | 
					
						
							|  |  |  |                 <xsl:otherwise> | 
					
						
							| 
									
										
										
										
											2017-07-12 07:28:55 +03:00
										 |  |  |                   <xsl:value-of select="concat(round(translate(translate($max, translate($max, '0123456789,.', ''), ''), ',', '.') * 0.3048 * 1000) div 1000, ' m')"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |                 </xsl:otherwise> | 
					
						
							|  |  |  |               </xsl:choose> | 
					
						
							|  |  |  |             </xsl:attribute> | 
					
						
							|  |  |  |           </xsl:if> | 
					
						
							|  |  |  |           <xsl:if test="$mean != ''"> | 
					
						
							|  |  |  |             <xsl:attribute name="mean"> | 
					
						
							|  |  |  |               <xsl:choose> | 
					
						
							|  |  |  |                 <xsl:when test="$units = 0"> | 
					
						
							|  |  |  |                   <xsl:value-of select="$mean"/> | 
					
						
							|  |  |  |                 </xsl:when> | 
					
						
							|  |  |  |                 <xsl:otherwise> | 
					
						
							| 
									
										
										
										
											2017-07-12 07:28:55 +03:00
										 |  |  |                   <xsl:value-of select="concat(round(translate(translate($mean, translate($mean, '0123456789,.', ''), ''), ',', '.') * 0.3048 * 1000) div 1000, ' m')"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |                 </xsl:otherwise> | 
					
						
							|  |  |  |               </xsl:choose> | 
					
						
							|  |  |  |             </xsl:attribute> | 
					
						
							|  |  |  |           </xsl:if> | 
					
						
							|  |  |  |         </depth> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <divetemperature> | 
					
						
							|  |  |  |           <xsl:variable name="air"> | 
					
						
							|  |  |  |             <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:22:36 +03:00
										 |  |  |               <xsl:with-param name="index" select="8"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |               <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |             </xsl:call-template> | 
					
						
							|  |  |  |           </xsl:variable> | 
					
						
							|  |  |  |           <xsl:variable name="water"> | 
					
						
							|  |  |  |             <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:22:36 +03:00
										 |  |  |               <xsl:with-param name="index" select="9"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |               <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |             </xsl:call-template> | 
					
						
							|  |  |  |           </xsl:variable> | 
					
						
							|  |  |  |           <xsl:if test="$air != ''"> | 
					
						
							|  |  |  |             <xsl:attribute name="air"> | 
					
						
							|  |  |  |               <xsl:choose> | 
					
						
							|  |  |  |                 <xsl:when test="$units = 0"> | 
					
						
							|  |  |  |                   <xsl:value-of select="$air"/> | 
					
						
							|  |  |  |                 </xsl:when> | 
					
						
							|  |  |  |                 <xsl:otherwise> | 
					
						
							| 
									
										
										
										
											2017-07-12 07:28:55 +03:00
										 |  |  |                   <xsl:value-of select="concat(format-number((translate(translate($air, translate($air, '0123456789,.', ''), ''), ',', '.') - 32) * 5 div 9, '0.0'), ' C')"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |                 </xsl:otherwise> | 
					
						
							|  |  |  |               </xsl:choose> | 
					
						
							|  |  |  |             </xsl:attribute> | 
					
						
							|  |  |  |           </xsl:if> | 
					
						
							|  |  |  |           <xsl:if test="$water != ''"> | 
					
						
							|  |  |  |             <xsl:attribute name="water"> | 
					
						
							|  |  |  |               <xsl:choose> | 
					
						
							|  |  |  |                 <xsl:when test="$units = 0"> | 
					
						
							|  |  |  |                   <xsl:value-of select="$water"/> | 
					
						
							|  |  |  |                 </xsl:when> | 
					
						
							|  |  |  |                 <xsl:otherwise> | 
					
						
							| 
									
										
										
										
											2017-07-12 07:28:55 +03:00
										 |  |  |                   <xsl:value-of select="concat(format-number((translate(translate($water, translate($water, '0123456789,.', ''), ''), ',', '.') - 32) * 5 div 9, '0.0'), ' C')"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |                 </xsl:otherwise> | 
					
						
							|  |  |  |               </xsl:choose> | 
					
						
							|  |  |  |             </xsl:attribute> | 
					
						
							|  |  |  |           </xsl:if> | 
					
						
							|  |  |  |         </divetemperature> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |         <!-- CYLINDER --> | 
					
						
							|  |  |  |         <xsl:call-template name="parseCylinders"> | 
					
						
							|  |  |  |           <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           <xsl:with-param name="cylinders" select="$cylinders"/> | 
					
						
							|  |  |  |           <xsl:with-param name="count" select="'0'"/> | 
					
						
							|  |  |  |           <xsl:with-param name="index" select="'10'"/> | 
					
						
							|  |  |  |         </xsl:call-template> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-24 17:29:28 +03:00
										 |  |  |         <location> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |           <xsl:variable name="gps"> | 
					
						
							|  |  |  |             <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |               <xsl:with-param name="index" select="16 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |               <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |             </xsl:call-template> | 
					
						
							|  |  |  |           </xsl:variable> | 
					
						
							|  |  |  |           <xsl:variable name="location"> | 
					
						
							|  |  |  |             <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |               <xsl:with-param name="index" select="15 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |               <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |             </xsl:call-template> | 
					
						
							|  |  |  |           </xsl:variable> | 
					
						
							|  |  |  |           <xsl:if test="$gps != ''"> | 
					
						
							|  |  |  |             <xsl:attribute name="gps"> | 
					
						
							|  |  |  |               <xsl:value-of select="$gps"/> | 
					
						
							|  |  |  |             </xsl:attribute> | 
					
						
							|  |  |  |           </xsl:if> | 
					
						
							|  |  |  |           <xsl:if test="$location != ''"> | 
					
						
							|  |  |  |             <xsl:value-of select="$location"/> | 
					
						
							|  |  |  |           </xsl:if> | 
					
						
							|  |  |  |         </location> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <xsl:variable name="dm"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |             <xsl:with-param name="index" select="17 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:if test="$dm != ''"> | 
					
						
							|  |  |  |           <divemaster> | 
					
						
							|  |  |  |             <xsl:value-of select="$dm"/> | 
					
						
							|  |  |  |           </divemaster> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <xsl:variable name="buddy"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |             <xsl:with-param name="index" select="18 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:if test="$buddy != ''"> | 
					
						
							|  |  |  |           <buddy> | 
					
						
							|  |  |  |             <xsl:value-of select="$buddy"/> | 
					
						
							|  |  |  |           </buddy> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <xsl:variable name="suit"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |             <xsl:with-param name="index" select="19 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:if test="$suit != ''"> | 
					
						
							|  |  |  |           <suit> | 
					
						
							|  |  |  |             <xsl:value-of select="$suit"/> | 
					
						
							|  |  |  |           </suit> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |         </xsl:if> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:variable name="notes"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |             <xsl:with-param name="index" select="22 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |             <xsl:with-param name="remaining" select="$remaining"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:if test="$notes != ''"> | 
					
						
							|  |  |  |           <notes> | 
					
						
							|  |  |  |             <xsl:value-of select="$notes"/> | 
					
						
							|  |  |  |           </notes> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <xsl:variable name="weight"> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |             <xsl:with-param name="index" select="23 + ($cylinders - 1) * 5"/> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |         <xsl:if test="$weight != ''"> | 
					
						
							|  |  |  |           <weightsystem description="unknown"> | 
					
						
							|  |  |  |             <xsl:attribute name="weight"> | 
					
						
							|  |  |  |               <xsl:choose> | 
					
						
							|  |  |  |                 <xsl:when test="$units = 0"> | 
					
						
							|  |  |  |                   <xsl:value-of select="$weight"/> | 
					
						
							|  |  |  |                 </xsl:when> | 
					
						
							|  |  |  |                 <xsl:otherwise> | 
					
						
							| 
									
										
										
										
											2017-07-12 07:28:55 +03:00
										 |  |  |                   <xsl:value-of select="concat(format-number((translate($weight, translate($weight, '0123456789', ''), '') * 0.453592), '#.##'), ' kg')"/> | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |                 </xsl:otherwise> | 
					
						
							|  |  |  |               </xsl:choose> | 
					
						
							|  |  |  |             </xsl:attribute> | 
					
						
							|  |  |  |           </weightsystem> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |         </xsl:if> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-05 10:53:24 +02:00
										 |  |  |       </dive> | 
					
						
							|  |  |  |     </xsl:if> | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  |   </xsl:template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |   <xsl:template name="countCylinders"> | 
					
						
							|  |  |  |     <xsl:param name="line"/> | 
					
						
							|  |  |  |     <xsl:param name="count"/> | 
					
						
							|  |  |  |     <xsl:param name="index"/> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <xsl:variable name="field"> | 
					
						
							|  |  |  |       <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |         <xsl:with-param name="index" select="$index"/> | 
					
						
							|  |  |  |         <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |       </xsl:call-template> | 
					
						
							|  |  |  |     </xsl:variable> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <xsl:choose> | 
					
						
							|  |  |  |       <xsl:when test="substring-before($field, ' ') = 'cylinder'"> | 
					
						
							|  |  |  |         <xsl:call-template name="countCylinders"> | 
					
						
							|  |  |  |           <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           <xsl:with-param name="count" select="$count + 1"/> | 
					
						
							|  |  |  |           <xsl:with-param name="index" select="$index + 5"/> | 
					
						
							|  |  |  |         </xsl:call-template> | 
					
						
							|  |  |  |       </xsl:when> | 
					
						
							|  |  |  |       <xsl:otherwise> | 
					
						
							|  |  |  |         <xsl:value-of select="$count"/> | 
					
						
							|  |  |  |       </xsl:otherwise> | 
					
						
							|  |  |  |     </xsl:choose> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   </xsl:template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   <xsl:template name="parseCylinders"> | 
					
						
							|  |  |  |     <xsl:param name="line"/> | 
					
						
							|  |  |  |     <xsl:param name="cylinders"/> | 
					
						
							|  |  |  |     <xsl:param name="count"/> | 
					
						
							|  |  |  |     <xsl:param name="index"/> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <xsl:variable name="field"> | 
					
						
							|  |  |  |       <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |         <xsl:with-param name="index" select="$index"/> | 
					
						
							|  |  |  |         <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |       </xsl:call-template> | 
					
						
							|  |  |  |     </xsl:variable> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <xsl:if test="$count < $cylinders"> | 
					
						
							|  |  |  |       <cylinder> | 
					
						
							|  |  |  |         <xsl:variable name="size"> | 
					
						
							|  |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |             <xsl:with-param name="index" select="$index"/> | 
					
						
							|  |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							|  |  |  |         <xsl:variable name="start"> | 
					
						
							|  |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |             <xsl:with-param name="index" select="$index + 1"/> | 
					
						
							|  |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							|  |  |  |         <xsl:variable name="end"> | 
					
						
							|  |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |             <xsl:with-param name="index" select="$index + 2"/> | 
					
						
							|  |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							|  |  |  |         <xsl:variable name="o2"> | 
					
						
							|  |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |             <xsl:with-param name="index" select="$index + 3"/> | 
					
						
							|  |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							|  |  |  |         <xsl:variable name="he"> | 
					
						
							|  |  |  |           <xsl:call-template name="getFieldByIndex"> | 
					
						
							|  |  |  |             <xsl:with-param name="index" select="$index + 4"/> | 
					
						
							|  |  |  |             <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |           </xsl:call-template> | 
					
						
							|  |  |  |         </xsl:variable> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         <xsl:if test="$size != ''"> | 
					
						
							|  |  |  |           <xsl:attribute name="size"> | 
					
						
							|  |  |  |             <xsl:choose> | 
					
						
							|  |  |  |               <xsl:when test="substring($size, 1, 2) = 'AL'"> | 
					
						
							|  |  |  |                 <xsl:value-of select="format-number((translate($size, translate($size, '0123456789', ''), '') * 14.7 div 3000) div 0.035315, '#.#')"/> | 
					
						
							|  |  |  |               </xsl:when> | 
					
						
							|  |  |  |               <xsl:when test="substring($size, 1, 2) = 'LP'"> | 
					
						
							|  |  |  |                 <xsl:value-of select="format-number((translate($size, translate($size, '0123456789', ''), '') * 14.7 div 2400) div 0.035315, '#.#')"/> | 
					
						
							|  |  |  |               </xsl:when> | 
					
						
							|  |  |  |               <xsl:when test="substring($size, 1, 2) = 'HP'"> | 
					
						
							|  |  |  |                 <xsl:value-of select="format-number((translate($size, translate($size, '0123456789', ''), '') * 14.7 div 3440) div 0.035315, '#.#')"/> | 
					
						
							|  |  |  |               </xsl:when> | 
					
						
							|  |  |  |               <xsl:otherwise> | 
					
						
							|  |  |  |                 <xsl:choose> | 
					
						
							|  |  |  |                   <xsl:when test="$units = 0"> | 
					
						
							|  |  |  |                     <xsl:value-of select="$size"/> | 
					
						
							|  |  |  |                   </xsl:when> | 
					
						
							|  |  |  |                   <xsl:otherwise> | 
					
						
							| 
									
										
										
										
											2020-05-24 17:29:42 +03:00
										 |  |  |                     <xsl:value-of select="format-number((translate($size, translate($size, '0123456789,.', ''), '') * 14.7 div 3000) div 0.035315, '#.#')"/> | 
					
						
							| 
									
										
										
										
											2020-05-21 17:51:33 +03:00
										 |  |  |                   </xsl:otherwise> | 
					
						
							|  |  |  |                 </xsl:choose> | 
					
						
							|  |  |  |               </xsl:otherwise> | 
					
						
							|  |  |  |             </xsl:choose> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  |         <xsl:if test="substring($size, 1, 2) = 'AL' or substring($size, 1, 2) = 'LP' or substring($size, 1, 2) = 'HP'"> | 
					
						
							|  |  |  |           <xsl:attribute name="description"> | 
					
						
							|  |  |  |             <xsl:value-of select="$size"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  |         <xsl:if test="$start != ''"> | 
					
						
							|  |  |  |           <xsl:attribute name="start"> | 
					
						
							|  |  |  |             <xsl:choose> | 
					
						
							|  |  |  |               <xsl:when test="$units = 0"> | 
					
						
							|  |  |  |                 <xsl:value-of select="$start"/> | 
					
						
							|  |  |  |               </xsl:when> | 
					
						
							|  |  |  |               <xsl:otherwise> | 
					
						
							|  |  |  |                 <xsl:value-of select="concat(format-number((translate($start, translate($start, '0123456789', ''), '') div 14.5037738007), '#'), ' bar')"/> | 
					
						
							|  |  |  |               </xsl:otherwise> | 
					
						
							|  |  |  |             </xsl:choose> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  |         <xsl:if test="$end != ''"> | 
					
						
							|  |  |  |           <xsl:attribute name="end"> | 
					
						
							|  |  |  |             <xsl:choose> | 
					
						
							|  |  |  |               <xsl:when test="$units = 0"> | 
					
						
							|  |  |  |                 <xsl:value-of select="$end"/> | 
					
						
							|  |  |  |               </xsl:when> | 
					
						
							|  |  |  |               <xsl:otherwise> | 
					
						
							|  |  |  |                 <xsl:value-of select="concat(format-number((translate($end, translate($end, '0123456789', ''), '') div 14.5037738007), '#'), ' bar')"/> | 
					
						
							|  |  |  |               </xsl:otherwise> | 
					
						
							|  |  |  |             </xsl:choose> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  |         <xsl:if test="$o2 != ''"> | 
					
						
							|  |  |  |           <xsl:attribute name="o2"> | 
					
						
							|  |  |  |             <xsl:value-of select="$o2"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  |         <xsl:if test="$he != ''"> | 
					
						
							|  |  |  |           <xsl:attribute name="he"> | 
					
						
							|  |  |  |             <xsl:value-of select="$he"/> | 
					
						
							|  |  |  |           </xsl:attribute> | 
					
						
							|  |  |  |         </xsl:if> | 
					
						
							|  |  |  |       </cylinder> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       <xsl:call-template name="parseCylinders"> | 
					
						
							|  |  |  |         <xsl:with-param name="line" select="$line"/> | 
					
						
							|  |  |  |         <xsl:with-param name="cylinders" select="$cylinders"/> | 
					
						
							|  |  |  |         <xsl:with-param name="count" select="$count + 1"/> | 
					
						
							|  |  |  |         <xsl:with-param name="index" select="$index + 5"/> | 
					
						
							|  |  |  |       </xsl:call-template> | 
					
						
							|  |  |  |     </xsl:if> | 
					
						
							|  |  |  |   </xsl:template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-12-26 16:11:38 +02:00
										 |  |  | </xsl:stylesheet> |