[MOBY-guts] biomoby commit

Sebastien Carrere carrere at dev.open-bio.org
Wed Jun 20 12:36:27 UTC 2007


carrere
Wed Jun 20 08:36:24 EDT 2007
Update of /home/repository/moby/moby-live/Perl/MOBY/xsl
In directory dev.open-bio.org:/tmp/cvs-serv19023/xsl

Modified Files:
	parseMobyMessage.xsl 
Log Message:
Exceptions are now parsed


moby-live/Perl/MOBY/xsl parseMobyMessage.xsl,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/xsl/parseMobyMessage.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Perl/MOBY/xsl/parseMobyMessage.xsl	2005/10/24 11:47:03	1.2
+++ /home/repository/moby/moby-live/Perl/MOBY/xsl/parseMobyMessage.xsl	2007/06/20 12:36:24	1.3
@@ -11,11 +11,8 @@
 	</xsl:template>
 
 	<xsl:template match="moby:serviceNotes">
-		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES#</xsl:text>
-		<xsl:value-of select="normalize-space(.)"/>
-		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES#</xsl:text>
-		<xsl:text>
-</xsl:text>
+		<!--<xsl:value-of select="normalize-space(.)"/>-->
+		<xsl:call-template name="complexServiceNotes"/>
 	</xsl:template>
 
 	<xsl:template match="moby:mobyData">
@@ -221,12 +218,20 @@
 		<!-- Retrieve Object Content -->
 		
 		<xsl:text>#XSL_LIPM_MOBYPARSER_OBJECTCONTENT#</xsl:text>
-		<xsl:value-of select="."/>
+		<!-- je normalise, normalement le contenu est dans du CDATA -->
+		<!--<xsl:value-of select="normalize-space(.)"/>-->
+		<xsl:call-template name="treatContent"/>
+		<xsl:variable name="sonTest" select="name(./child::*)"/>
+		<xsl:if test="$sonTest = ''">
+			<xsl:value-of select="."/>
+		</xsl:if>
+		<!--<xsl:value-of select="."/>-->
 		<xsl:text>#XSL_LIPM_MOBYPARSER_OBJECTCONTENT#</xsl:text>
 		<xsl:text>
 </xsl:text>
 
-		<xsl:for-each select="./child::*">
+		<!--<xsl:for-each select="./child::*">-->
+		<!--	<xsl:for-each select="./child::*">
 			<xsl:choose>
 				<xsl:when test="contains(name(.),'CrossReference')">
 					<xsl:call-template name="crossReference"/>
@@ -234,6 +239,9 @@
 				<xsl:when test="contains(name(.),'Xref')">
 					<xsl:call-template name="crossReference"/>
 				</xsl:when>
+				<xsl:when test="contains(name(.),'ProvisionInformation')">
+					<xsl:call-template name="provisionInformation"/>
+				</xsl:when>
 				<xsl:otherwise>
 					<xsl:text>#XSL_LIPM_MOBYPARSER_OBJECTHASA_START#</xsl:text>
 			<xsl:text>
@@ -243,6 +251,7 @@
 				</xsl:otherwise>
 			</xsl:choose>
 		</xsl:for-each>
+	-->
 		
 	</xsl:template>
 	
@@ -250,6 +259,35 @@
 	
 	<!--
 	
+	TEMPLATE CONTENT
+	
+	-->
+	
+	<xsl:template name="treatContent">
+		<xsl:for-each select="./child::*">
+			<xsl:choose>
+				<xsl:when test="contains(name(.),'CrossReference')">
+					<xsl:call-template name="crossReference"/>
+				</xsl:when>
+				<xsl:when test="contains(name(.),'Xref')">
+					<xsl:call-template name="crossReference"/>
+				</xsl:when>
+				<xsl:when test="contains(name(.),'ProvisionInformation')">
+					<xsl:call-template name="provisionInformation"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:text>#XSL_LIPM_MOBYPARSER_OBJECTHASA_START#</xsl:text>
+			<xsl:text>
+</xsl:text>
+						<xsl:call-template name="objectClass"/>
+					<xsl:text>#XSL_LIPM_MOBYPARSER_OBJECTHASA_END#</xsl:text>
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:for-each>
+	</xsl:template>
+	
+	<!--
+	
 	TEMPLATE CROSS/X/REF
 	
 	-->
@@ -279,4 +317,159 @@
 		
 	</xsl:template>
 	
+	<!--
+	
+	Provision Information Block
+	
+	-->
+
+	
+	
+	<xsl:template name="provisionInformation">
+		<xsl:for-each select="./child::*">
+			<xsl:variable name="provisionInformation" select="normalize-space(name(.))"/>
+			<xsl:text>#XSL_LIPM_MOBYPARSER_PIB_START#</xsl:text>
+			<xsl:if test="contains(name(.),'serviceSoftware')">
+				<xsl:variable name="softwareName" select="normalize-space(./@software_name)"/>
+				<xsl:variable name="softwareVersion" select="normalize-space(./@software_version)"/>
+				<xsl:variable name="softwareComment" select="normalize-space(./@software_comment)"/>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_SOFTWARE_START#</xsl:text>
+				<xsl:if test="$softwareName != ''"><xsl:value-of select="$softwareName"/></xsl:if>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_SOFTWARE_SEP#</xsl:text>
+				<xsl:if test="$softwareVersion != ''"><xsl:value-of select="$softwareVersion"/></xsl:if>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_SOFTWARE_SEP#</xsl:text>
+				<xsl:if test="$softwareComment != ''"><xsl:value-of select="$softwareComment"/></xsl:if>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_SOFTWARE_END#</xsl:text>
+			</xsl:if>
+			<xsl:if test="contains(name(.),'serviceDatabase')">
+				<xsl:variable name="databaseName" select="normalize-space(./@database_name)"/>
+				<xsl:variable name="databaseVersion" select="normalize-space(./@database_version)"/>
+				<xsl:variable name="databaseComment" select="normalize-space(./@database_comment)"/>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_DATABASE_START#</xsl:text>
+				<xsl:if test="$databaseName != ''"><xsl:value-of select="$databaseName"/></xsl:if>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_DATABASE_SEP#</xsl:text>
+				<xsl:if test="$databaseVersion != ''"><xsl:value-of select="$databaseVersion"/></xsl:if>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_DATABASE_SEP#</xsl:text>
+				<xsl:if test="$databaseComment != ''"><xsl:value-of select="$databaseComment"/></xsl:if>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_DATABASE_END#</xsl:text>
+			</xsl:if>
+			<xsl:if test="contains(name(.),'serviceComment')">
+				<xsl:variable name="comment" select="."/>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_COMMENT_START#</xsl:text>
+				<xsl:if test="$comment != ''"><xsl:value-of select="$comment"/></xsl:if>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_COMMENT_END#</xsl:text>
+			</xsl:if>
+			<xsl:text>#XSL_LIPM_MOBYPARSER_PIB_END#</xsl:text>
+			<xsl:text>
+</xsl:text>
+		</xsl:for-each>
+		
+	</xsl:template>
+
+
+	<!--
+	
+	TEMPLATE Service Notes
+	
+	-->
+	
+	<xsl:template name="complexServiceNotes">
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES#</xsl:text>
+		<xsl:if test="count(./child::*) = 0">
+			<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_NOTES_START#</xsl:text>
+				<xsl:value-of select="."/>
+			<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_NOTES_END#</xsl:text>
+		</xsl:if>
+		<xsl:for-each select="./child::*">
+			<xsl:if test="contains(name(.),'mobyException')">
+				<xsl:call-template name="treatException"/>
+			</xsl:if>
+			<xsl:if test="contains(name(.),'Notes')">
+				<xsl:call-template name="treatNotes"/>
+			</xsl:if>		
+		</xsl:for-each>
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES#</xsl:text>
+		<xsl:text>
+</xsl:text>
+	</xsl:template>
+
+	<!--
+	
+	TEMPLATE Service Notes : traitement des exceptions
+	
+	-->
+	<xsl:template name="treatException">
+		
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_START#</xsl:text>
+		
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_REFELEMENT_START#</xsl:text>
+		<xsl:variable name="refelt1" select="normalize-space(./@refElement)"/>
+		<xsl:variable name="refelt2" select="normalize-space(./@moby:refElement)"/>
+		<xsl:if test="$refelt1 != ''">
+			<xsl:value-of select="$refelt1"/>
+		</xsl:if>
+		<xsl:if test="$refelt2 != ''">
+			<xsl:value-of select="$refelt2"/>
+		</xsl:if>
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_REFELEMENT_END#</xsl:text>
+		
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_REFQUERYID_START#</xsl:text>
+		<xsl:variable name="refqid1" select="normalize-space(./@refQueryID)"/>
+		<xsl:variable name="refqid2" select="normalize-space(./@moby:refQueryID)"/>
+		<xsl:if test="$refelt1 != ''">
+			<xsl:value-of select="$refqid1"/>
+		</xsl:if>
+		<xsl:if test="$refqid2 != ''">
+			<xsl:value-of select="$refqid2"/>
+		</xsl:if>
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_REFQUERYID_END#</xsl:text>
+		
+		
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_SEVERITY_START#</xsl:text>
+		<xsl:variable name="sev1" select="normalize-space(./@severity)"/>
+		<xsl:variable name="sev2" select="normalize-space(./@moby:severity)"/>
+		<xsl:if test="$sev1 != ''">
+			<xsl:value-of select="$sev1"/>
+		</xsl:if>
+		<xsl:if test="$sev2 != ''">
+			<xsl:value-of select="$sev2"/>
+		</xsl:if>
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_SEVERITY_END#</xsl:text>
+		
+		
+		<xsl:for-each select="./child::*">
+			<xsl:if test="contains(name(.),'exceptionCode')">
+				<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_CODE_START#</xsl:text>
+				<xsl:value-of select="."/>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_CODE_END#</xsl:text>
+			</xsl:if>
+			<xsl:if test="contains(name(.),'exceptionMessage')">
+				<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_MESSAGE_START#</xsl:text>
+				<xsl:value-of select="."/>
+				<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_MESSAGE_END#</xsl:text>
+			</xsl:if>
+		</xsl:for-each>
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_EXCEPTION_END#</xsl:text>
+<!--		<xsl:text>
+</xsl:text>
+-->
+	</xsl:template>
+
+	<!--
+	
+	TEMPLATE Service Notes : traitement des notes
+	
+	-->
+	
+	
+	<xsl:template name="treatNotes">
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_NOTES_START#</xsl:text>
+			<xsl:value-of select="."/>
+		<xsl:text>#XSL_LIPM_MOBYPARSER_SERVICENOTES_NOTES_END#</xsl:text>
+<!--		<xsl:text>
+</xsl:text>
+-->
+	</xsl:template>
+
+
 </xsl:stylesheet> 




More information about the MOBY-guts mailing list