2002/ws/desc/test-suite/results-messages build.xml,NONE,1.1 generate-xpath-assertions-soap.xslt,NONE,1.1 generate-xpath-assertions.xslt,NONE,1.1 ws-i.xsl,NONE,1.1

Update of /sources/public/2002/ws/desc/test-suite/results-messages
In directory hutz:/tmp/cvs-serv23566

Added Files:
	build.xml generate-xpath-assertions-soap.xslt 
	generate-xpath-assertions.xslt ws-i.xsl 
Log Message:
New files

--- NEW FILE: generate-xpath-assertions-soap.xslt ---
<?xml version="1.0" encoding="utf-8"?>
<!--

$Header: /sources/public/2002/ws/desc/test-suite/results-messages/generate-xpath-assertions-soap.xslt,v 1.1 2006/11/16 15:10:56 plehegar Exp $

Convert WSDL Component model into XPath expressions

-->
<xsl:stylesheet version="1.0"
		xmlns:lsoap="http://www.w3.org/2002/ws/desc/logs/eval/soap"
		xmlns:l="http://www.w3.org/2002/ws/desc/logs/"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:cm='http://www.w3.org/2002/ws/desc/wsdl/component'
		xmlns:cmextensions='http://www.w3.org/2002/ws/desc/wsdl/component-extensions'
		xmlns:cmbase='http://www.w3.org/2002/ws/desc/wsdl/component-base'
		xmlns:cmhttp='http://www.w3.org/2002/ws/desc/wsdl/component-http'
		xmlns:cmrpc='http://www.w3.org/2002/ws/desc/wsdl/component-rpc'
		xmlns:cmsoap='http://www.w3.org/2002/ws/desc/wsdl/component-soap'
		xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'
		xmlns:soap11='http://schemas.xmlsoap.org/soap/envelope/'
		exclude-result-prefixes='cmsoap cmrpc cmhttp cmbase cmextensions cm lsoap'>
  <xsl:output method="xml" indent="yes" />

  <xsl:key name='xmlId' match='*' use='@xml:id'/>

  <xsl:variable name='debug' select='0' />

  <xsl:template name='lsoap:checkSoap'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='endpointComponent'/>
    <xsl:param name='bindingComponent'/>
    <!-- XPath expression to the message in the log, e.g. "/l:log/l:message[@number='2']" -->
    <xsl:param name='logMessage'/>

    <xsl:choose>
      <xsl:when test='$bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"'>
      </xsl:when>
      <xsl:when test='$bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol="http://www.w3.org/2006/01/soap11/bindings/HTTP/"'>
      </xsl:when>
      <xsl:otherwise>
	<xsl:message>Unknown underlying protocol <xsl:value-of select='$bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol'/></xsl:message>
      </xsl:otherwise>
    </xsl:choose>

    <xsl:if test='$bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"
		  or $bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol="http://www.w3.org/2006/01/soap11/bindings/HTTP"'>
      <xsl:call-template name='lsoap:checkSoapHTTPMethod'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='endpointComponent' select='$endpointComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
	<xsl:with-param name='logMessage' select='$logMessage'/>
      </xsl:call-template>

      <xsl:call-template name='lsoap:checkSoapHTTPContentType'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='endpointComponent' select='$endpointComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
	<xsl:with-param name='logMessage' select='$logMessage'/>
      </xsl:call-template>
      
      <xsl:call-template name='lsoap:checkSoapHTTPSOAPAction'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='endpointComponent' select='$endpointComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
	<xsl:with-param name='logMessage' select='$logMessage'/>
      </xsl:call-template>
    </xsl:if>

    <xsl:variable name='method'>
      <xsl:call-template name='lsoap:getSoapHTTPMethod'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name='direction' select='$interfaceMessageReferenceComponent/cm:direction'/>

    <xsl:choose>
      <xsl:when test='$method="POST" or $direction="out"'>
	<xsl:call-template name='lsoap:checkSoapEnvelope'>
	  <xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	  <xsl:with-param name='bindingComponent' select='$bindingComponent'/>
	  <xsl:with-param name='logMessage' select='$logMessage'/>
	</xsl:call-template>
	<xsl:if test='$bindingComponent/cmsoap:soapBindingMessageReferenceExtension/cmsoap:soapHeaders'>
	  <xsl:call-template name='lsoap:checkSoapHeaders'>
	    <xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	    <xsl:with-param name='bindingComponent' select='$bindingComponent'/>
	    <xsl:with-param name='logMessage' select='$logMessage'/>
	  </xsl:call-template>
	</xsl:if>
	<xsl:call-template name='lsoap:checkSoapBody'>
	  <xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	  <xsl:with-param name='bindingComponent' select='$bindingComponent'/>
	  <xsl:with-param name='logMessage' select='$logMessage'/>
	</xsl:call-template>
      </xsl:when>
      <xsl:when test='$method="GET"'>
	<xsl:call-template name='generate-assertion'>
	  <xsl:with-param name='xpath'>
	    <xsl:text>count(</xsl:text>
	    <xsl:value-of select='$logMessage'/>
	    <xsl:text>/l:content/*) = 0</xsl:text>
	  </xsl:with-param>
	  <xsl:with-param name='description'>The message SHOULD NOT have a body when using HTTP GET</xsl:with-param>
	</xsl:call-template>
      </xsl:when>
    </xsl:choose>
  </xsl:template>


  <xsl:template name='lsoap:getSoapVersion'>
    <xsl:param name='bindingComponent'/>
    <xsl:choose>
      <xsl:when test='$bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapVersion'>
	<xsl:value-of select='$bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapVersion'/>
      </xsl:when>
      <xsl:otherwise>
	<xsl:text>@@No SOAP version?!?</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name='lsoap:getSoapMEP'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='bindingComponent'/>

    <xsl:variable name='soapVersion'>
      <xsl:call-template name='lsoap:getSoapVersion'>
	<xsl:with-param name='bindingComponent' select='$bindingComponent' />
      </xsl:call-template>
    </xsl:variable>

    <xsl:variable name='operationId' select='string($interfaceMessageReferenceComponent/@xml:id)' />

    <xsl:choose>
      <xsl:when test='$interfaceMessageReferenceComponent/../../cm:messageExchangePattern="http://www.w3.org/2006/01/wsdl/in-out"
		       or $interfaceMessageReferenceComponent/../../cm:messageExchangePattern="http://www.w3.org/2006/01/wsdl/in-only"
		       or $interfaceMessageReferenceComponent/../../cm:messageExchangePattern="http://www.w3.org/2006/01/wsdl/robust-in-only"'>
	<xsl:choose>
	  <xsl:when test='$bindingComponent/cm:bindingOperations/cm:bindingOperationComponent[cm:interfaceOperation[@ref=$operationId]]/cmsoap:soapBindingOperationExtension/cmsoap:soapMep'>
	    <xsl:value-of select='$bindingComponent/cm:bindingOperations/cm:bindingOperationComponent[cm:interfaceOperation[@ref=$operationId]]/cmsoap:soapBindingOperationExtension/cmsoap:soapMep'/>
	  </xsl:when>
	  <xsl:when test='$bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapMepDefault'>
	    <xsl:value-of select='$bindingComponent/cmsoap:soapBindingExtension/cmsoap:soapMepDefault'/>
	  </xsl:when>
	  <xsl:otherwise>
	    <xsl:text>http://www.w3.org/2003/05/soap/mep/request-response/</xsl:text>	    
	  </xsl:otherwise>
	</xsl:choose>
      </xsl:when>
      <xsl:otherwise>
	<xsl:text>@@</xsl:text>
	<xsl:value-of select='$interfaceMessageReferenceComponent/../../cm:messageExchangePattern'/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name='lsoap:getSoapHTTPMethod'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='bindingComponent'/>

    <xsl:variable name='direction' select='$interfaceMessageReferenceComponent/cm:direction'/>
    <xsl:variable name='soapMep'>
      <xsl:call-template name='lsoap:getSoapMEP'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name='soapVersion'>
      <xsl:call-template name='lsoap:getSoapVersion'>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:choose>
      <xsl:when test='$direction="in" and $soapMep="http://www.w3.org/2003/05/soap/mep/soap-response/"'>
	<xsl:text>GET</xsl:text>
      </xsl:when>
      <xsl:when test='$direction="in" and ($soapMep="http://www.w3.org/2003/05/soap/mep/request-response/"
		                           or $soapVersion="1.1")'>
	<xsl:text>POST</xsl:text>
      </xsl:when>
      <xsl:otherwise>
	<xsl:value-of select='$soapMep'/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name='lsoap:checkSoapHTTPMethod'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='bindingComponent'/>
    <xsl:param name='logMessage'/>

    <xsl:variable name='direction' select='$interfaceMessageReferenceComponent/cm:direction'/>
    <xsl:variable name='soapMep'>
      <xsl:call-template name='lsoap:getSoapMEP'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name='soapVersion'>
      <xsl:call-template name='lsoap:getSoapVersion'>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name='method'>
      <xsl:call-template name='lsoap:getSoapHTTPMethod'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:if test='$debug'>
    <xsl:message>
      <xsl:text>INFORMATION: Binding </xsl:text>
      <xsl:value-of select='$bindingComponent/cm:name/cmbase:namespaceName'/>
      <xsl:text>{</xsl:text>
      <xsl:value-of select='$bindingComponent/cm:name/cmbase:localName'/>
      <xsl:text>}
   Operation </xsl:text>
      <xsl:value-of select='$interfaceMessageReferenceComponent/../../cm:name/cmbase:namespaceName'/>
      <xsl:text>{</xsl:text>
      <xsl:value-of select='$interfaceMessageReferenceComponent/../../cm:name/cmbase:localName'/>
      <xsl:text>}
      WSDL MEP: </xsl:text>
      <xsl:value-of select='$interfaceMessageReferenceComponent/../../cm:messageExchangePattern' /><xsl:text>
      SOAP MEP: </xsl:text>
    <xsl:value-of select='$soapMep'/></xsl:message> 
    </xsl:if>

    <xsl:call-template name='generate-assertion'>
      <xsl:with-param name='xpath'>
	<xsl:value-of select='$logMessage'/>
	<xsl:text>/l:httpHeaders</xsl:text>
	<xsl:choose>
	  <xsl:when test='$direction="in"'>
	    <xsl:text>/l:Method[@value='</xsl:text><xsl:value-of select='$method'/><xsl:text>']</xsl:text>
	  </xsl:when>
	  <xsl:when test='$direction="out"'>
	    <xsl:text>/l:StatusCode[@value='200']</xsl:text>
	  </xsl:when>
	  <xsl:otherwise>
	    <xsl:text>@@InvalidDirection</xsl:text>
	  </xsl:otherwise>
	</xsl:choose>
      </xsl:with-param>      
      <xsl:with-param name='description'>
	<xsl:choose>
	  <xsl:when test='$direction="in"'>
	    <xsl:text>The message request MUST use the proper HTTP Method</xsl:text>
	  </xsl:when>
	  <xsl:otherwise>
	    <xsl:text>The message response MUST use the proper HTTP status code</xsl:text>
	  </xsl:otherwise>
	</xsl:choose>
      </xsl:with-param>
    </xsl:call-template>
  </xsl:template>

  <xsl:template name='lsoap:checkSoapHTTPContentType'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='bindingComponent'/>
    <xsl:param name='logMessage'/>
    <xsl:variable name='direction' select='$interfaceMessageReferenceComponent/cm:direction'/>
    <xsl:variable name='soapMep'>
      <xsl:call-template name='lsoap:getSoapMEP'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:variable name='soapVersion'>
      <xsl:call-template name='lsoap:getSoapVersion'>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:if test='not($direction="in" and $soapMep="http://www.w3.org/2003/05/soap/mep/soap-response/")'>
      <xsl:comment>Is the proper HTTP Content Type used?</xsl:comment>
      <xsl:call-template name='generate-assertion'>
	<xsl:with-param name='xpath'>
	  <xsl:value-of select='$logMessage'/>
	  <xsl:text>/l:httpHeaders/l:Content-Type/@type = </xsl:text>
	  <xsl:choose>
	    <xsl:when test='$soapVersion="1.2"'>
	      <xsl:text>'application/soap+xml'</xsl:text>
	    </xsl:when>
	    <xsl:when test='$soapVersion="1.1"'>
	      <xsl:text>'text/xml'</xsl:text>
	    </xsl:when>
	    <xsl:when test='$soapVersion="unknown"'>
	    </xsl:when>
	  </xsl:choose>
	</xsl:with-param>
	<xsl:with-param name='description'>The message MUST use the proper Content-Type HTTP Header</xsl:with-param>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
  
  <xsl:template name='lsoap:checkSoapHTTPSOAPAction'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='bindingComponent'/>
    <xsl:param name='logMessage'/>

    <xsl:variable name='direction' select='$interfaceMessageReferenceComponent/cm:direction'/>

    <xsl:variable name='soapVersion'>
      <xsl:call-template name='lsoap:getSoapVersion'>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:if test='$direction="in" and $bindingComponent/cmsoap:soapBindingOperationExtension/cmsoap:soapAction'>
      <xsl:comment>Is the proper HTTP SOAP Action used?</xsl:comment>
      <xsl:call-template name='generate-assertion'>
	<xsl:with-param name='xpath'>
	  <xsl:value-of select='$logMessage'/>
	  <xsl:text>/l:httpHeaders/l:SOAPAction = '</xsl:text>
	  <xsl:if test='$soapVersion="1.1"'>
	    <xsl:text>"</xsl:text>
	  </xsl:if>
	  <xsl:value-of select='$bindingComponent/cmsoap:soapBindingOperationExtension/cmsoap:soapAction'/>
	  <xsl:if test='$soapVersion="1.1"'>
	    <xsl:text>"</xsl:text>
	  </xsl:if>
	  <xsl:text>'</xsl:text>
	</xsl:with-param>
	<xsl:with-param name='description'>The message MUST use the proper SOAPAction HTTP Header</xsl:with-param>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
  
  <xsl:template name='lsoap:checkSoapEnvelope'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='bindingComponent'/>
    <xsl:param name='logMessage'/>

    <xsl:variable name='direction' select='$interfaceMessageReferenceComponent/cm:direction'/>
    <xsl:variable name='soapMep'>
      <xsl:call-template name='lsoap:getSoapMEP'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name='soapVersion'>
      <xsl:call-template name='lsoap:getSoapVersion'>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:if test='not($direction="in" and $soapMep="http://www.w3.org/2003/05/soap/mep/soap-response/")'>
      <xsl:comment>Is the proper SOAP Envelope used?</xsl:comment>
      
      <xsl:call-template name='generate-assertion'>
	<xsl:with-param name='xpath'>
	  <xsl:value-of select='$logMessage'/>
	  <xsl:choose>
	    <xsl:when test='$soapVersion="1.2"'>
	      <xsl:text>/l:content/soap12:Envelope</xsl:text>
	    </xsl:when>
	    <xsl:when test='$soapVersion="1.1"'>
	      <xsl:text>/l:content/soap11:Envelope</xsl:text>
	    </xsl:when>
	    <xsl:when test='$soapVersion="unknown"'>
	    </xsl:when>
	  </xsl:choose>
	</xsl:with-param>
	<xsl:with-param name='description'>The message MUST use the proper SOAP <xsl:value-of select='$soapVersion'/> Envelope</xsl:with-param>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template name='lsoap:checkSoapHeaders'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='bindingComponent'/>
    <xsl:param name='logMessage'/>

    <xsl:variable name='soapMep'>
      <xsl:call-template name='lsoap:getSoapMEP'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name='msgCModel' select='$interfaceMessageReferenceComponent/cm:messageContentModel'/>
    <xsl:variable name='soapVersion'>
      <xsl:call-template name='lsoap:getSoapVersion'>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>

    <!-- Construct the path to the soap headers -->
    <xsl:variable name='headers'>
      <xsl:value-of select='$logMessage'/>
      <xsl:choose>
	<xsl:when test='$soapVersion="1.2"'>
	  <xsl:text>/l:content/soap12:Envelope/soap12:Headers</xsl:text>
	</xsl:when>
	<xsl:when test='$soapVersion="1.1"'>
	  <xsl:text>/l:content/soap11:Envelope/soap11:Headers</xsl:text>
	</xsl:when>
	<xsl:when test='$soapVersion="unknown"'>
	</xsl:when>
      </xsl:choose>
    </xsl:variable>

    <xsl:message><xsl:text>Need to check </xsl:text><xsl:value-of select='$headers'/><xsl:text>
</xsl:text></xsl:message>
    
  </xsl:template>

  <xsl:template name='lsoap:checkSoapBody'>
    <xsl:param name='interfaceMessageReferenceComponent'/>
    <xsl:param name='bindingComponent'/>
    <xsl:param name='logMessage'/>

    <xsl:variable name='direction' select='$interfaceMessageReferenceComponent/cm:direction'/>
    <xsl:variable name='soapMep'>
      <xsl:call-template name='lsoap:getSoapMEP'>
	<xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name='msgCModel' select='$interfaceMessageReferenceComponent/cm:messageContentModel'/>
    <xsl:variable name='soapVersion'>
      <xsl:call-template name='lsoap:getSoapVersion'>
	<xsl:with-param name='bindingComponent' select='$bindingComponent'/>
      </xsl:call-template>
    </xsl:variable>

    <!-- Construct the path to the soap body -->
    <xsl:variable name='body'>
      <xsl:value-of select='$logMessage'/>
      <xsl:choose>
	<xsl:when test='$soapVersion="1.2"'>
	  <xsl:text>/l:content/soap12:Envelope/soap12:Body</xsl:text>
	</xsl:when>
	<xsl:when test='$soapVersion="1.1"'>
	  <xsl:text>/l:content/soap11:Envelope/soap11:Body</xsl:text>
	</xsl:when>
	<xsl:when test='$soapVersion="unknown"'>
	</xsl:when>
      </xsl:choose>
    </xsl:variable>

    <xsl:if test='not($direction="in" and $soapMep="http://www.w3.org/2003/05/soap/mep/soap-response/")'>

      <!-- check that we have the number of elements within the Body
	   as well as the right root element
      -->    
      <xsl:comment>Do we have the appropriate number of elements in the Body?</xsl:comment>
      <xsl:choose>
	<xsl:when test='$msgCModel="#any"'>
	  <!-- it's anything, just check the number.
	       is it really one or can it be more?
	  -->
	  <xsl:call-template name='generate-assertion'>
	    <xsl:with-param name='xpath'>
	      <xsl:text>count(</xsl:text>
	      <xsl:value-of select='$body'/>
	    <xsl:text>/*) = 1</xsl:text>      </xsl:with-param>      
	    <xsl:with-param name='description'>The message MUST have one element</xsl:with-param>
	  </xsl:call-template>

	</xsl:when>
	<xsl:when test='$msgCModel="#other"'>
	  <!-- it's nothing or something
	       is it really one or can it be more?
	  -->
	  <xsl:call-template name='generate-assertion'>
	    <xsl:with-param name='xpath'>
	    <xsl:value-of select='$body'/>      </xsl:with-param>      
	    <xsl:with-param name='description'>The message MUST use the proper SOAP Body</xsl:with-param>
	  </xsl:call-template>

	</xsl:when>
	<xsl:when test='$msgCModel="#none"'>
	  <xsl:call-template name='generate-assertion'>
	    <xsl:with-param name='xpath'>
	      <xsl:text>count(</xsl:text>
	      <xsl:value-of select='$body'/>
	    <xsl:text>/*) = 0</xsl:text>      </xsl:with-param>      
	    <xsl:with-param name='description'>The SOAP Body MUST must be empty</xsl:with-param>
	  </xsl:call-template>

	</xsl:when>
	<xsl:when test='$msgCModel="#element"'>
	  <xsl:variable name='elRef' select='key("xmlId", $interfaceMessageReferenceComponent/cm:elementDeclaration/@ref)'/>
	  
	  <xsl:call-template name='generate-assertion'>
	    <xsl:with-param name='xpath'>
	      <xsl:text>count(</xsl:text>
	      <xsl:value-of select='$body'/>
	    <xsl:text>/*) = 1</xsl:text>      </xsl:with-param>      
	    <xsl:with-param name='description'>The SOAP Body MUST have one element</xsl:with-param>
	  </xsl:call-template>

	  
	  <xsl:comment>Is the proper element used in the SOAP Body?</xsl:comment>
	  <xsl:call-template name='generate-assertion'>
	    <xsl:with-param name='xpath'>
	      <xsl:value-of select='$body'/>
	      <xsl:text>/*[local-name()='</xsl:text>
	      <xsl:value-of select='$elRef/cm:name/cmbase:localName'/>
	      <xsl:text>' and namespace-uri()='</xsl:text>
	      <xsl:value-of select='$elRef/cm:name/cmbase:namespaceName'/>
	    <xsl:text>']</xsl:text>      </xsl:with-param>      
	    <xsl:with-param name='description'>The SOAP Body content MUST contain an element of the proper type</xsl:with-param>
	  </xsl:call-template>
	  
	</xsl:when>
	<xsl:otherwise>
	  <xsl:call-template name='generate-assertion'>
	    <xsl:with-param name='xpath'>
	    <xsl:text>@@invalidMessageContentModel</xsl:text>      </xsl:with-param>      
	  </xsl:call-template>
	</xsl:otherwise>
      </xsl:choose>
    </xsl:if>

  </xsl:template>

</xsl:stylesheet>

--- NEW FILE: generate-xpath-assertions.xslt ---
<?xml version="1.0" encoding="utf-8"?>
<!--

    $Header: /sources/public/2002/ws/desc/test-suite/results-messages/generate-xpath-assertions.xslt,v 1.1 2006/11/16 15:10:56 plehegar Exp $

    Convert WSDL Component model into XPath expressions

-->
<xsl:stylesheet version="1.0"
		xmlns="http://www.w3.org/1999/xhtml"
		xmlns:l="http://www.w3.org/2002/ws/desc/logs/"
		xmlns:lsoap="http://www.w3.org/2002/ws/desc/logs/eval/soap"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:cm='http://www.w3.org/2002/ws/desc/wsdl/component'
		xmlns:cmextensions='http://www.w3.org/2002/ws/desc/wsdl/component-extensions'
		xmlns:cmbase='http://www.w3.org/2002/ws/desc/wsdl/component-base'
		xmlns:cmhttp='http://www.w3.org/2002/ws/desc/wsdl/component-http'
		xmlns:cmrpc='http://www.w3.org/2002/ws/desc/wsdl/component-rpc'
		xmlns:cmsoap='http://www.w3.org/2002/ws/desc/wsdl/component-soap'
		xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'
		xmlns:soap11='http://schemas.xmlsoap.org/soap/envelope/'
		exclude-result-prefixes='cmsoap cmrpc cmhttp cmbase cmextensions cm lsoap'>
  <xsl:output method="xml" indent="yes" />

  <xsl:include href='generate-xpath-assertions-soap.xslt'/>

  <xsl:key name='xmlId' match='*' use='@xml:id'/>

  <xsl:template match='/'>
    <xsl:comment>
 This is a style sheet, generated by generate-xpath-assertions.xslt.
 ******** DO NOT EDIT *********
</xsl:comment>
    <xsl:element name='xsl:stylesheet'>
      <xsl:attribute name='version' namespace=''>1.0</xsl:attribute>
      <xsl:element name='xsl:output'>
	<xsl:attribute name='method' namespace=''>xml</xsl:attribute>
	<xsl:attribute name='indent' namespace=''>yes</xsl:attribute>	
      </xsl:element>
      <xsl:element name='xsl:template'>
	<xsl:attribute name='match' namespace=''>/</xsl:attribute>
	<html>
	  <head>
	    <title>Results</title>
	    <link rel="stylesheet" type="text/css" href=
		  "http://www.w3.org/StyleSheets/TR/base.css" />
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	  </head>
	  <body>
	    <h1>Message exchange results</h1>
	    
	    <div>
	      <xsl:call-template name='process-endpointComponents'>
		<xsl:with-param name='endpointComponents' select='/cm:descriptionComponent/cm:services/cm:serviceComponent/cm:endpoints/cm:endpointComponent'/>
		<xsl:with-param name='start'>0</xsl:with-param>
	      </xsl:call-template>
	    </div>
	  </body>
	</html>
      </xsl:element>
    </xsl:element>
  </xsl:template>

  <!-- Process a list of endpoint components -->
  <xsl:template name='process-endpointComponents'>
    <xsl:param name='endpointComponents'/>
    <!-- how many operations processed before this endpoint component list? -->
    <xsl:param name='start'/>


    <xsl:if test='count($endpointComponents) != 0'>

      <!-- process the first element of the list -->
      <xsl:call-template name='process-endpointComponent'>
	<xsl:with-param name='endpointComponent' select='$endpointComponents[position()=1]'/>
	<xsl:with-param name='start' select='$start'/>
      </xsl:call-template>

      <!-- count how many operations are attached to the endpoint -->
      <xsl:variable name='current'>
	<xsl:call-template name='count-messages-in-interfaceReferences'>
	  <xsl:with-param name='interfaceReferences'
			  select='$endpointComponents[position()=1]/ancestor::cm:serviceComponent/cm:interface'/>
	</xsl:call-template>
      </xsl:variable>

      <!-- process the remainder of the list -->
      <xsl:call-template name='process-endpointComponents'>
	<xsl:with-param name='endpointComponents' select='$endpointComponents[position()>1]'/>
	<xsl:with-param name='start' select='$start + $current'/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template name='process-endpointComponent'>
    <xsl:param name='endpointComponent' />
    <xsl:param name='start' />

    <xsl:variable name='bindingComponent'
		  select='key("xmlId", $endpointComponent/cm:binding/@ref)' />

    <h2><xsl:text>EndpointComponent </xsl:text>
    <xsl:value-of select='$endpointComponent/cm:name' /><br />
    <xsl:text>BindingComponent </xsl:text>
    <xsl:value-of
	select='$bindingComponent/cm:name/cmbase:namespaceName'/>{<xsl:value-of
	select='$bindingComponent/cm:name/cmbase:localName'/>}</h2>


    <xsl:call-template name='process-interfaceReferences'>
      <xsl:with-param name='interfaceReferences'
		      select='$endpointComponent/ancestor::cm:serviceComponent/cm:interface'/>
      <xsl:with-param name='endpointComponent'
		      select='$endpointComponent'/>
      <xsl:with-param name='start' select='$start'/>
    </xsl:call-template>
    
  </xsl:template>

  <!-- Process each interface operation component for a given list of interface[@ref] -->
  <xsl:template name='process-interfaceReferences'>
    <!-- list of interface[@ref] -->
    <xsl:param name='interfaceReferences' />
    <xsl:param name='endpointComponent' />
    <xsl:param name='start' />
    
    <xsl:choose>
      <xsl:when test='count($interfaceReferences) = 0'>
      </xsl:when>
      <xsl:otherwise>
	<xsl:variable name='interfaceComponent'
		      select='key("xmlId", $interfaceReferences[position()=1]/@ref)' />

	<xsl:variable name='extended'>
	  <xsl:call-template name='count-messages-in-interfaceReferences'>
	    <xsl:with-param name='interfaceReferences' select='$interfaceComponent/cm:extendedInterfaces/cm:interface'/>
	  </xsl:call-template>
	</xsl:variable>

	<xsl:variable name='current'>
	  <xsl:call-template name='count-messages-in-interfaceOperationComponents'>
	    <xsl:with-param name='interfaceOperationComponents'
			    select='$interfaceComponent/cm:interfaceOperations/cm:interfaceOperationComponent'/>
	  </xsl:call-template>
	</xsl:variable>

	<xsl:call-template name='process-interfaceReferences'>
	  <xsl:with-param name='interfaceReferences' select='$interfaceComponent/cm:extendedInterfaces/cm:interface'/>
	  <xsl:with-param name='endpointComponent' select='$endpointComponent' />
	  <xsl:with-param name='start' select='$start' />
	</xsl:call-template>
	
	<h3><xsl:text>Interface </xsl:text> <xsl:value-of
	select='$interfaceComponent/cm:name/cmbase:namespaceName'/>{<xsl:value-of
	select='$interfaceComponent/cm:name/cmbase:localName'/>}</h3>

	<xsl:call-template name='process-interfaceOperationComponents'>
	  <xsl:with-param name='interfaceOperationComponents'
			  select='$interfaceComponent/cm:interfaceOperations/cm:interfaceOperationComponent'/>
	  <xsl:with-param name='endpointComponent' select='$endpointComponent' />
	  <xsl:with-param name='start' select='$start + $extended' />
	</xsl:call-template>

	<xsl:call-template name='process-interfaceReferences'>
	  <xsl:with-param name='interfaceReferences' select='$interfaceReferences[position()>1]'/>
	  <xsl:with-param name='endpointComponent' select='$endpointComponent' />
	  <xsl:with-param name='start' select='$start + $extended + $current' />
	</xsl:call-template>

      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name='process-interfaceOperationComponents'>
    <xsl:param name='interfaceOperationComponents' />
    <xsl:param name='endpointComponent' />
    <xsl:param name='start' />

    <xsl:variable name='interfaceOperationComponent'
		  select='$interfaceOperationComponents[position()=1]'/>
    <xsl:variable name='mep' select='$interfaceOperationComponent/cm:messageExchangePattern'/>

    <xsl:variable name='prettyMep'>
      <xsl:choose>
	<xsl:when test='$mep = "http://www.w3.org/2006/01/wsdl/in-out"'>
	  <xsl:text>in-out</xsl:text>
	</xsl:when>
	<xsl:when test='$mep = "http://www.w3.org/2006/01/wsdl/in-only"'>
	  <xsl:text>in-only</xsl:text>
	</xsl:when>
	<xsl:when test='$mep = "http://www.w3.org/2006/01/wsdl/robust-in-only"'>
	  <xsl:text>robust-in-only</xsl:text>
	</xsl:when>
      </xsl:choose>
    </xsl:variable>

    <h4><xsl:text>[</xsl:text><code>o<xsl:value-of select='$start + 1' /></code><xsl:text>] Operation </xsl:text>
    <xsl:value-of select='$prettyMep'/>
    <xsl:text> </xsl:text>
    <xsl:value-of select='$interfaceOperationComponent/cm:name/cmbase:namespaceName'/>
    <xsl:text>{</xsl:text>
    <xsl:value-of select='$interfaceOperationComponent/cm:name/cmbase:localName'/>
    <xsl:text>}</xsl:text></h4>

    <dl>

    <!-- Process the input message -->
    <xsl:call-template name='process-interfaceMessageReferenceComponent'>
      <xsl:with-param name='interfaceMessageReferenceComponent'
		      select='$interfaceOperationComponent/cm:interfaceMessageReferences/cm:interfaceMessageReferenceComponent[cm:direction="in"]' />
      <xsl:with-param name='endpointComponent' select='$endpointComponent' />
      <xsl:with-param name='position' select='$start + 1' />
    </xsl:call-template>

    <!-- Process the output or fault message -->    
    <xsl:choose>
      <xsl:when test='contains($interfaceOperationComponent/cm:name/cmbase:localName, "Fault")'>
	<!-- We have a fault message to process -->
	<xsl:call-template name='process-interfaceFaultReferenceComponent'>
	  <xsl:with-param name='interfaceFaultReferenceComponent'
			  select='$interfaceOperationComponent/cm:interfaceFaultReferences/cm:interfaceFaultReferenceComponent[cm:direction="out"]' />
	  <xsl:with-param name='endpointComponent' select='$endpointComponent' />
	  <xsl:with-param name='position' select='$start + 2' />
	</xsl:call-template>
      </xsl:when>
      <xsl:when test='$mep = "http://www.w3.org/2006/01/wsdl/in-out"'>
	<!-- We have a normal output message to process -->
	<xsl:call-template name='process-interfaceMessageReferenceComponent'>
	  <xsl:with-param name='interfaceMessageReferenceComponent'
			  select='$interfaceOperationComponent/cm:interfaceMessageReferences/cm:interfaceMessageReferenceComponent[cm:direction="out"]' />
	  <xsl:with-param name='endpointComponent' select='$endpointComponent' />
	  <xsl:with-param name='position' select='$start + 2' />
	</xsl:call-template>
      </xsl:when>
      <xsl:when test='$mep = "http://www.w3.org/2006/01/wsdl/in-only"'>
	<!-- We have an empty output message to process -->
	<xsl:call-template name='process-interfaceOperationComponent-EmptyOutput'>
	  <xsl:with-param name='interfaceOperationComponent'
			  select='$interfaceOperationComponent' />
	  <xsl:with-param name='endpointComponent' select='$endpointComponent' />
	  <xsl:with-param name='position' select='$start + 2' />
	</xsl:call-template>
      </xsl:when>
      <xsl:when test='$mep = "http://www.w3.org/2006/01/wsdl/robust-in-only"'>
	<!-- No output message -->
      </xsl:when>
    </xsl:choose>

    </dl>

    <!-- Process the rest of the operations -->

    <xsl:if test='count($interfaceOperationComponents) > 1'>
      <xsl:variable name='current'>
	<xsl:call-template name='count-messages-in-interfaceOperationComponents'>
	  <xsl:with-param name='interfaceOperationComponents'
			  select='$interfaceOperationComponent'/>
	</xsl:call-template>
      </xsl:variable>

      <xsl:call-template name='process-interfaceOperationComponents'>
	<xsl:with-param name='interfaceOperationComponents'
			select='$interfaceOperationComponents[position()>1]'/>
	<xsl:with-param name='endpointComponent' select='$endpointComponent' />
	<xsl:with-param name='start' select='$start + $current' />
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <xsl:template name='process-interfaceMessageReferenceComponent'>
    <xsl:param name='interfaceMessageReferenceComponent' />
    <xsl:param name='endpointComponent'/>
    <xsl:param name='position' />

    <xsl:variable name='direction' select='$interfaceMessageReferenceComponent/cm:direction'/>

    <xsl:variable name='logMessage'>
      <xsl:text>/l:log/l:message[@number='</xsl:text>
      <xsl:value-of select='$position'/>
      <xsl:text>']</xsl:text>
    </xsl:variable>


    <dt>[m<xsl:value-of select='substring($direction, 1, 1)'/><xsl:value-of select='$position' />] Message <code><xsl:value-of select='$direction'/></code>
    <xsl:call-template name='printMessageInformation'>
      <xsl:with-param name='logMessage' select='$logMessage' />
    </xsl:call-template>
    </dt>

    <dd class='message'>

      <xsl:choose>
	<xsl:when test='$direction="in"'>
	  <xsl:call-template name='generate-assertion'>
	    <xsl:with-param name='xpath'>
	      <xsl:value-of select='$logMessage'/><xsl:text>/@type='request'</xsl:text>
	    </xsl:with-param>
	    <xsl:with-param name='description'>The message exchange MUST include a request message</xsl:with-param>
	  </xsl:call-template>
	</xsl:when>
	<xsl:when test='$direction="out"'>
	  <xsl:call-template name='generate-assertion'>
	    <xsl:with-param name='xpath'>
	      <xsl:value-of select='$logMessage'/><xsl:text>/@type='response'</xsl:text>
	    </xsl:with-param>
	    <xsl:with-param name='description'>The message exchange MUST include a response message</xsl:with-param>
	  </xsl:call-template>
	</xsl:when>
      </xsl:choose>

      <xsl:variable name='bindingComponent'
		    select='key("xmlId", $endpointComponent/cm:binding/@ref)'/>

      <xsl:if test='$bindingComponent/cm:type="http://www.w3.org/2006/01/wsdl/soap"'>
	<xsl:call-template name='lsoap:checkSoap'>
	  <xsl:with-param name='interfaceMessageReferenceComponent' select='$interfaceMessageReferenceComponent'/>
	  <xsl:with-param name='endpointComponent' select='$endpointComponent'/>
	  <xsl:with-param name='bindingComponent' select='$bindingComponent'/>
	  <xsl:with-param name='logMessage' select='$logMessage'/>
	</xsl:call-template>
      </xsl:if>
    </dd>
  </xsl:template>

  <xsl:template name='process-interfaceFaultReferenceComponent'>
    <xsl:param name='interfaceFaultReferenceComponent' />
    <xsl:param name='endpointComponent'/>
    <xsl:param name='position' />

    <xsl:variable name='direction' select='$interfaceFaultReferenceComponent/cm:direction'/>

    <xsl:variable name='logMessage'>
      <xsl:text>/l:log/l:message[@number='</xsl:text>
      <xsl:value-of select='$position'/>
      <xsl:text>']</xsl:text>
    </xsl:variable>

    <dt>[fo<xsl:value-of select='$position' />] Fault <code><xsl:value-of select='$direction'/></code>
    <xsl:call-template name='printMessageInformation'>
      <xsl:with-param name='logMessage' select='$logMessage' />
    </xsl:call-template>
    </dt>
    <dd class='message'>

      <xsl:call-template name='generate-assertion'>
	<xsl:with-param name='xpath'>
	  <xsl:value-of select='$logMessage'/><xsl:text>/@type='response'</xsl:text>
	</xsl:with-param>
	<xsl:with-param name='description'>The message exchange MUST include a fault response message</xsl:with-param>
      </xsl:call-template>

<!--	
	<xsl:if test='$bindingRef/../../cm:type="http://www.w3.org/2006/01/wsdl/soap"'>
	  <xsl:call-template name='lsoap:checkSoap'>
	    <xsl:with-param name='msgRef' select='$msgRef'/>
	    <xsl:with-param name='bindingRef' select='$bindingRef'/>
	    <xsl:with-param name='logMessage' select='$logMessage'/>
	  </xsl:call-template>
	</xsl:if>
-->
    </dd>
  </xsl:template>

  <xsl:template name='process-interfaceOperationComponent-EmptyOutput'>
    <xsl:param name='interfaceOperationComponent' />
    <xsl:param name='endpointComponent'/>
    <xsl:param name='position' />

    <xsl:variable name='logMessage'>
      <xsl:text>/l:log/l:message[@number='</xsl:text>
      <xsl:value-of select='$position'/>
      <xsl:text>']</xsl:text>
    </xsl:variable>

    <dt>[mo<xsl:value-of select='$position' />] Message <code>out</code>
    <xsl:call-template name='printMessageInformation'>
      <xsl:with-param name='logMessage' select='$logMessage' />
    </xsl:call-template>
    </dt>
    <dd class='message'>

      <xsl:call-template name='generate-assertion'>
	<xsl:with-param name='xpath'>
	  <xsl:value-of select='$logMessage'/><xsl:text>/@type='response'</xsl:text>
	</xsl:with-param>
	<xsl:with-param name='description'>The message exchange MUST include a response message</xsl:with-param>
      </xsl:call-template>

<!--	
	<xsl:if test='$bindingRef/../../cm:type="http://www.w3.org/2006/01/wsdl/soap"'>
	  <xsl:call-template name='lsoap:checkSoap'>
	    <xsl:with-param name='msgRef' select='$msgRef'/>
	    <xsl:with-param name='bindingRef' select='$bindingRef'/>
	    <xsl:with-param name='logMessage' select='$logMessage'/>
	  </xsl:call-template>
	</xsl:if>
-->
    </dd>
  </xsl:template>

  <xsl:template name='printMessageInformation'>
    <xsl:param name='logMessage' />

    <xsl:element name='xsl:choose'>
      <xsl:element name='xsl:when'>
	<xsl:attribute name='test' namespace=''>
	  <xsl:value-of select='$logMessage'/>
	  <xsl:text>/@timestamp</xsl:text>
	</xsl:attribute>	  
	<xsl:text> @ </xsl:text>
	<code class='timestamp'><xsl:element name='xsl:value-of'>
	  <xsl:attribute name='select' namespace=''>
	    <xsl:value-of select='$logMessage'/>
	    <xsl:text>/@timestamp</xsl:text>
	  </xsl:attribute>
	</xsl:element></code>
      </xsl:element>
      <xsl:element name='xsl:otherwise'>
	<span class='failure'> doesn't exist!</span>
      </xsl:element>	  
    </xsl:element>

    <xsl:element name='if' namespace='http://www.w3.org/1999/XSL/Transform'>
      <xsl:attribute name='test' namespace=''>
	<xsl:value-of select='$logMessage'/>
	<xsl:text>/l:senderHostAndPort</xsl:text>
      </xsl:attribute>	  
      <xsl:text> [</xsl:text>
      <code class='from'><xsl:element name='value-of' namespace='http://www.w3.org/1999/XSL/Transform'>
	<xsl:attribute name='select' namespace=''>
	  <xsl:value-of select='$logMessage'/>
	  <xsl:text>/l:senderHostAndPort</xsl:text>
	</xsl:attribute>
      </xsl:element></code>
    </xsl:element>
    <xsl:element name='if' namespace='http://www.w3.org/1999/XSL/Transform'>
      <xsl:attribute name='test' namespace=''>
	<xsl:value-of select='$logMessage'/>
	<xsl:text>/l:receiverHostAndPort</xsl:text>
      </xsl:attribute>	  
      <xsl:text> &#8680; </xsl:text>
      <code class='to'><xsl:element name='value-of' namespace='http://www.w3.org/1999/XSL/Transform'>
	<xsl:attribute name='select' namespace=''>
	  <xsl:value-of select='$logMessage'/>
	  <xsl:text>/l:receiverHostAndPort</xsl:text>
	</xsl:attribute>
      </xsl:element></code>
      <xsl:text>]</xsl:text>
    </xsl:element>
  </xsl:template>

  <!-- Returns the number of messages from a given list of interface[@ref] -->
  <xsl:template name='count-messages-in-interfaceReferences'>
    <!-- list of interface[@ref] -->
    <xsl:param name='interfaceReferences' />
    
    <xsl:choose>
      <xsl:when test='count($interfaceReferences) = 0'>
	<xsl:text>0</xsl:text>
      </xsl:when>
      <xsl:otherwise>
	<xsl:variable name='interfaceComponent'
		      select='key("xmlId", $interfaceReferences[position()=1]/@ref)' />

	<xsl:variable name='extended'>
	  <xsl:call-template name='count-messages-in-interfaceReferences'>
	    <xsl:with-param name='interfaceReferences' select='$interfaceComponent/cm:extendedInterfaces/cm:interface'/>
	  </xsl:call-template>
	</xsl:variable>

	<xsl:variable name='current'>
	  <xsl:call-template name='count-messages-in-interfaceOperationComponents'>
	    <xsl:with-param name='interfaceOperationComponents'
			    select='$interfaceComponent/cm:interfaceOperations/cm:interfaceOperationComponent'/>
	  </xsl:call-template>
	</xsl:variable>
	<xsl:variable name='rest'>
	  <xsl:call-template name='count-messages-in-interfaceReferences'>
	    <xsl:with-param name='interfaceReferences' select='$interfaceReferences[position()>1]'/>
	  </xsl:call-template>
	</xsl:variable>
	<xsl:value-of select='$extended + $current + $rest'/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name='count-messages-in-interfaceOperationComponents'>
    <xsl:param name='interfaceOperationComponents' />
    <xsl:choose>
      <xsl:when test='count($interfaceOperationComponents) = 0'>
	<xsl:text>0</xsl:text>
      </xsl:when>
      <xsl:otherwise>
	<xsl:variable name='rest'>
	  <xsl:call-template name='count-messages-in-interfaceOperationComponents'>
	    <xsl:with-param name='interfaceOperationComponents' select='$interfaceOperationComponents[position()>1]'/>
	  </xsl:call-template>
	</xsl:variable>
	<xsl:value-of select='2 + $rest'/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name='generate-assertion'>
    <xsl:param name='xpath'/>
    <xsl:param name='description'>No description available</xsl:param>

    <xsl:element name='xsl:choose'>
      <xsl:element name='xsl:when'>
	<xsl:attribute name="test" namespace=''>
	  <xsl:text>not(</xsl:text>
	  <xsl:value-of select='$xpath'/>
	  <xsl:text>)</xsl:text>
	</xsl:attribute>
	<p class='failure'>
	  <span class='description' style='color:red; font-weight: bold'><xsl:value-of select='$description'/></span>
	  <br />
	  <code class='xpath'><xsl:value-of select='$xpath'/></code>
	</p>
      </xsl:element>
      <xsl:element name='xsl:otherwise'>
	<p class='success'>
	  <span class='description' style='display: none'><xsl:value-of select='$description'/></span>
	  <span select='color: green'><xsl:text>[OK] </xsl:text></span>
	  <code class='xpath'><xsl:value-of select='$xpath'/></code>
	</p>
      </xsl:element>
    </xsl:element>
  </xsl:template>

</xsl:stylesheet>

--- NEW FILE: build.xml ---
<?xml version="1.0" encoding="UTF-8"?>
<project name="wsdl-interchange-format" default="main" basedir=".">

	<target name="main" depends="generate-message-log-result"/>

	<target name="clean" depends="clean-message-eval, clean-message-log-result"/>
<!--
	<target name="rollup" depends="evaluate-Woden, evaluate-Canon, evaluate-wsdl-xslt" description="roll up the results of evaluation into a results page.">
		<xslt style="combine.xslt" in="implementations.xml" out="interchange-summary.xml" force="yes"/>
		<tstamp />
		<xslt style="interchange-results.xsl" in="interchange-summary.xml" out="Overview.html" force="yes">
			<param name="DSTAMP" expression="${DSTAMP}"/>
			<param name="TSTAMP" expression="${TSTAMP}"/>
			<param name="TODAY" expression="${TODAY}"/>
		</xslt>
	</target>
-->
	<target name='generate-message-log-result' description='Evaluate the message logs'
		depends='convert-message-log, generate-message-eval'>
	  <xslt style="MessageTest-1G/SOAPservice-message-eval.xsl" extension="-results.html"
		basedir="MessageTest-1G" destdir="MessageTest-1G" includes="*.descmsg" />
	</target>
	

	<target name='convert-message-log' description='Convert WS-I Log messages into test suite format'>
		<xslt style='ws-i.xsl' basedir='.' destdir='.'>
			<mapper type="glob" from="*.wsimsg" to="*.descmsg" />
		</xslt>
	</target>

	<target name="clean-message-log-result">
		<delete>
		  <fileset dir="." includes="*/*-results.html"/>
		  <fileset dir="." includes="*/*.descmsg"/>
		</delete>
	</target>

	<target name='generate-message-eval' description='Convert WSDL Components into XPath assertions'
		depends='run-wsdl-xslt'>
	  <xslt style='generate-xpath-assertions.xslt' basedir='MessageTest-1G' destdir='MessageTest-1G'>
	    <mapper type="glob" from="*.wsdlcm" to="*-message-eval.xsl"/>
	  </xslt>
	</target>

	<!-- wsdl-xslt-specific tasks -->
	
	<target name="run-wsdl-xslt" description="Run wsdl-xslt to generate a complete set of wsdlcm files.">
		<xslt style="../results/wsdl-xslt/wsdl-component-model.xslt" extension=".wsdlcm"
			  basedir="../messages/good/MessageTest-1G" destdir="MessageTest-1G" includes="*.wsdl" />
	</target>

	<target name="clean-message-eval">
		<delete>
		  <fileset dir="." includes="*/*-message-eval.xsl"/>
		  <fileset dir="." includes="*/*.wsdlcm"/>
		</delete>
	</target>

	
</project>

--- NEW FILE: ws-i.xsl ---
<?xml version="1.0" encoding="UTF-8"?>
<!--

    $Header: /sources/public/2002/ws/desc/test-suite/results-messages/ws-i.xsl,v 1.1 2006/11/16 15:10:56 plehegar Exp $

    Convert WS-I Monitor file into WS-Addressing Log file

-->
<xsl:stylesheet version="1.0"
		xmlns="http://www.w3.org/2002/ws/desc/logs/"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:wsi-log303="http://www.ws-i.org/testing/2003/03/log/"
		xmlns:wsi-log407="http://www.ws-i.org/testing/2004/07/log/"
		exclude-result-prefixes='wsi-log303 wsi-log407'>
	<xsl:output method="xml" indent="yes"/>
	<xsl:variable name="bom">&lt;?xml</xsl:variable>
	<xsl:variable name="gone">&lt;?_xml</xsl:variable>
	<xsl:template match="wsi-log303:log">
		<log xmlns:l="http://www.w3.org/2002/ws/addressing/logs/">
			<xsl:for-each select="//wsi-log303:messageEntry">
				<xsl:variable name="content">
				  <xsl:choose>
				    <xsl:when test='contains(wsi-log303:httpHeaders, "Content-Type: text/xml")
						    or contains(wsi-log303:httpHeaders, "Content-Type: application/soap+xml")'>
					<xsl:call-template name="replaceContent">
						<xsl:with-param name="text" select="wsi-log303:messageContent"/>
						<xsl:with-param name="replace" select="$bom"/>
						<xsl:with-param name="with" select="$gone"/>
						<xsl:with-param name="disable-output-escaping" select="yes"/>
					</xsl:call-template>
				    </xsl:when>
				    <xsl:otherwise>
				      <xsl:value-of select="wsi-log303:messageContent"/>
				    </xsl:otherwise>
				  </xsl:choose>
				</xsl:variable>
				<message timestamp="{@timestamp}" conversation="{@conversationID}" number="{@ID}" type="{@type}">
				  <senderHostAndPort>
				    <xsl:copy-of select="wsi-log303:senderHostAndPort/@*"/>
				    <xsl:copy-of select="wsi-log303:senderHostAndPort/*|wsi-log303:senderHostAndPort/text()"/>
				  </senderHostAndPort>
				  <receiverHostAndPort>
				    <xsl:copy-of select="wsi-log303:receiverHostAndPort/@*"/>
				    <xsl:copy-of select="wsi-log303:receiverHostAndPort/*|wsi-log303:receiverHostAndPort/text()"/>
				  </receiverHostAndPort>
				  <httpHeaders>
				    <xsl:call-template name='replaceHeaders'>
				      <xsl:with-param name="text" select="wsi-log303:httpHeaders"/>
				    </xsl:call-template>
				  </httpHeaders>
				  <content>
				    <xsl:value-of select="$content" disable-output-escaping="yes"/>
				  </content>
				</message>
			</xsl:for-each>
		</log>
	</xsl:template>
	<xsl:template match="wsi-log407:log">
		<log>
			<xsl:for-each select="//wsi-log407:messageEntry">
				<xsl:variable name="content">
				  <xsl:choose>
				    <xsl:when test='contains(wsi-log407:httpHeaders, "Content-Type: text/xml")
						    or contains(wsi-log407:httpHeaders, "Content-Type: application/soap+xml")'>
					<xsl:call-template name="replaceContent">
						<xsl:with-param name="text" select="wsi-log407:messageContent"/>
						<xsl:with-param name="replace" select="$bom"/>
						<xsl:with-param name="with" select="$gone"/>
						<xsl:with-param name="disable-output-escaping" select="yes"/>
					</xsl:call-template>
				    </xsl:when>
				    <xsl:otherwise>
				      <xsl:value-of select="wsi-log407:messageContent"/>
				    </xsl:otherwise>
				  </xsl:choose>
				</xsl:variable>
				<message timestamp="{@timestamp}" conversation="{@conversationID}" number="{@ID}" type="{@type}">
				  <senderHostAndPort>
				    <xsl:copy-of select="wsi-log407:senderHostAndPort/@*"/>
				    <xsl:copy-of select="wsi-log407:senderHostAndPort/*|wsi-log407:senderHostAndPort/text()"/>
				  </senderHostAndPort>
				  <receiverHostAndPort>
				    <xsl:copy-of select="wsi-log407:receiverHostAndPort/@*"/>
				    <xsl:copy-of select="wsi-log407:receiverHostAndPort/*|wsi-log407:receiverHostAndPort/text()"/>
				  </receiverHostAndPort>
				  <httpHeaders>
				    <xsl:call-template name='replaceHeaders'>
				      <xsl:with-param name="text" select="wsi-log407:httpHeaders"/>
				    </xsl:call-template>
				  </httpHeaders>
				  <content>
				    <xsl:value-of select="$content" disable-output-escaping="yes"/>
				  </content>
				</message>
			</xsl:for-each>
		</log>
	</xsl:template>

	<xsl:template name="replaceHeaders">
	  <xsl:param name='text'/>

	  <xsl:choose>
	    <xsl:when test='contains($text, "&#xD;")'>
	      <xsl:call-template name='replaceHeaders'>
		<xsl:with-param name='text' select='substring-before($text, "&#xD;")'/>
	      </xsl:call-template>
	      <xsl:call-template name='replaceHeaders'>
		<xsl:with-param name='text' select='substring-after($text, "&#xD;")'/>
	      </xsl:call-template>
	    </xsl:when>
	    <xsl:when test='starts-with($text, "HTTP/1.")'>
	      <StatusCode value='{substring-before(substring-after($text, " "), " ")}'>
		<xsl:value-of select='$text'/>
	      </StatusCode>
	    </xsl:when>
	    <xsl:when test='starts-with($text, "POST ")'>
	      <Method value="POST">
		<xsl:call-template name='replaceURI'>
		  <xsl:with-param name='text' select='substring-before(substring-after($text, "POST "), " HTTP")'/>
		</xsl:call-template>
	      </Method>
	    </xsl:when>
	    <xsl:when test='starts-with($text, "PUT ")'>
	      <Method value="PUT">
		<xsl:call-template name='replaceURI'>
		  <xsl:with-param name='text' select='substring-before(substring-after($text, "PUT "), " HTTP")'/>
		</xsl:call-template>
	      </Method>
	    </xsl:when>
	    <xsl:when test='starts-with($text, "GET ")'>
	      <Method value="GET">
		<xsl:call-template name='replaceURI'>
		  <xsl:with-param name='text' select='substring-before(substring-after($text, "GET "), " HTTP")'/>
		</xsl:call-template>
	      </Method>
	    </xsl:when>
	    <xsl:when test='starts-with($text, "DELETE ")'>
	      <Method value="DELETE">
		<xsl:call-template name='replaceURI'>
		  <xsl:with-param name='text' select='substring-before(substring-after($text, "DELETE "), " HTTP")'/>
		</xsl:call-template>
	      </Method>
	    </xsl:when>
	    <xsl:when test='contains($text, ": ")'>
	      <xsl:variable name='name'>
		<xsl:value-of select='substring-before(normalize-space($text), ": ")'/>
	      </xsl:variable>
	      <xsl:element name='{$name}'>
		<xsl:variable name='content' select='substring-after($text, ": ")'/>
		<xsl:if test='$name="Content-Type"'>
		  <xsl:attribute name='type'>
		    <xsl:choose>
		      <xsl:when test='contains($content, ";")'>
			<xsl:value-of select='substring-before($content, ";")'/>
		      </xsl:when>
		      <xsl:otherwise>
			<xsl:value-of select='$content'/>
		      </xsl:otherwise>
		    </xsl:choose>
		  </xsl:attribute>
		</xsl:if>
		<xsl:value-of select='$content'/>
	      </xsl:element>
	    </xsl:when>
	    <xsl:otherwise>
	      <xsl:value-of select='$text' disable-output-escaping="yes"/>
	    </xsl:otherwise>
	  </xsl:choose>

	</xsl:template>

	<xsl:template name="replaceURI">
	  <xsl:param name='text'/>

	  <xsl:choose>
	    <xsl:when test='contains($text, "?")'>
	      <uri><xsl:value-of select='substring-before($text, "?")'/></uri>
	      <xsl:call-template name='replaceURIParams'>
		<xsl:with-param name='text' select='substring-after($text, "?")'/>
	      </xsl:call-template>
	    </xsl:when>
	    <xsl:otherwise>
	      <uri><xsl:value-of select='$text'/></uri>
	    </xsl:otherwise>
	  </xsl:choose>
	</xsl:template>

	<xsl:template name="replaceURIParams">
	  <xsl:param name='text'/>

	  <xsl:choose>
	    <xsl:when test='contains($text, "&amp;")'>
	      <xsl:call-template name='replaceURIParams'>
		<xsl:with-param name='text' select='substring-before($text, "&amp;")'/>
	      </xsl:call-template>
	      <xsl:call-template name='replaceURIParams'>
		<xsl:with-param name='text' select='substring-after($text, "&amp;")'/>
	      </xsl:call-template>
	    </xsl:when>
	    <xsl:when test='contains($text, "=")'>
	      <param name='{substring-before($text, "=")}'>
		<xsl:value-of select='substring-after($text, "=")'/>
	      </param>
	    </xsl:when>
	  </xsl:choose>

	</xsl:template>

	<!-- http://xsltsl.sourceforge.net/ -->
	<xsl:template name="replaceContent">
		<xsl:param name="text"/>
		<xsl:param name="replace"/>
		<xsl:param name="with"/>
		<xsl:param name="disable-output-escaping">no</xsl:param>
		<xsl:choose>
			<xsl:when test="string-length($replace) = 0 and $disable-output-escaping = 'yes'">
				<xsl:value-of select="$text" disable-output-escaping="yes"/>
			</xsl:when>
			<xsl:when test="string-length($replace) = 0">
				<xsl:value-of select="$text"/>
			</xsl:when>
			<xsl:when test="contains($text, $replace)">
				<xsl:variable name="before" select="substring-before($text, $replace)"/>
				<xsl:variable name="after" select="substring-after($text, $replace)"/>
				<xsl:choose>
					<xsl:when test='$disable-output-escaping = "yes"'>
						<xsl:value-of select="$before" disable-output-escaping="yes"/>
						<xsl:value-of select="$with" disable-output-escaping="yes"/>
					</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="$before"/>
						<xsl:value-of select="$with"/>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:call-template name="replaceContent">
					<xsl:with-param name="text" select="$after"/>
					<xsl:with-param name="replace" select="$replace"/>
					<xsl:with-param name="with" select="$with"/>
					<xsl:with-param name="disable-output-escaping" select="$disable-output-escaping"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:when test='$disable-output-escaping = "yes"'>
				<xsl:value-of select="$text" disable-output-escaping="yes"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$text"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>

Received on Thursday, 16 November 2006 15:11:27 UTC