- From: Philippe Le Hegaret via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 24 Oct 2006 16:53:11 +0000
- To: public-ws-desc-eds@w3.org
Update of /sources/public/2002/ws/desc/test-suite/messages In directory hutz:/tmp/cvs-serv26371 Added Files: generate-xpath-assertions-soap.xsl generate-xpath-assertions.xsl Log Message: First shot at converting wsdlcm into XPath assertions --- NEW FILE: generate-xpath-assertions-soap.xsl --- <?xml version="1.0" encoding="utf-8"?> <!-- $Header: /sources/public/2002/ws/desc/test-suite/messages/generate-xpath-assertions-soap.xsl,v 1.1 2006/10/24 16:53:09 plehegar Exp $ Convert WSDL Component model into XPath expressions --> <xsl:stylesheet version="1.0" 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 xpath'> <xsl:output method="xml" indent="yes" /> <xsl:key name='xmlId' match='*' use='@xml:id'/> <xsl:template name='checkSoap'> <!-- interfaceMessageReferenceComponent node --> <xsl:param name='msgRef'/> <!-- bindingOperationComponent node --> <xsl:param name='bindingRef'/> <!-- XPath expression to the message in the log, e.g. "/l:log/l:message[@number='2']" --> <xsl:param name='xmessage'/> <xsl:choose> <xsl:when test='$bindingRef/../../cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"'> </xsl:when> <xsl:when test='$bindingRef/../../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='$bindingRef/../../cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol'/></xsl:message> </xsl:otherwise> </xsl:choose> <xsl:if test='$bindingRef/../../cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol="http://www.w3.org/2003/05/soap/bindings/HTTP/" or $bindingRef/../../cmsoap:soapBindingExtension/cmsoap:soapUnderlyingProtocol="http://www.w3.org/2006/01/soap11/bindings/HTTP"'> <xsl:call-template name='checkSoapHTTPMethod'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </xsl:call-template> <xsl:call-template name='checkSoapHTTPContentType'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </xsl:call-template> <xsl:call-template name='checkSoapHTTPSOAPAction'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </xsl:call-template> </xsl:if> <xsl:variable name='method'> <xsl:call-template name='getSoapHTTPMethod'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> </xsl:call-template> </xsl:variable> <xsl:variable name='direction' select='$msgRef/cm:direction'/> <xsl:choose> <xsl:when test='$method="POST" or $direction="out"'> <xsl:call-template name='checkSoapEnvelope'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </xsl:call-template> <xsl:call-template name='checkSoapBody'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </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='$xmessage'/> <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='getSoapVersion'> <xsl:param name='bindingRef'/> <xsl:choose> <xsl:when test='$bindingRef/../../cmsoap:soapBindingExtension/cmsoap:soapVersion'> <xsl:value-of select='$bindingRef/../../cmsoap:soapBindingExtension/cmsoap:soapVersion'/> </xsl:when> <xsl:otherwise> <xsl:text>@@No SOAP version?!?</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name='getSoapMEP'> <xsl:param name='msgRef'/> <xsl:param name='bindingRef'/> <xsl:choose> <xsl:when test='$bindingRef/cmsoap:soapBindingOperationExtension/cmsoap:soapMep'> <xsl:value-of select='$bindingRef/cmsoap:soapBindingOperationExtension/cmsoap:soapMep'/> </xsl:when> <xsl:when test='../../cmsoap:soapBindingExtension/cmsoap:soapMepDefault'> <xsl:value-of select='$bindingRef/../../cmsoap:soapBindingExtension/cmsoap:soapMepDefault'/> </xsl:when> <xsl:when test='$msgRef/../../cm:messageExchangePattern="http://www.w3.org/2006/01/wsdl/in-out"'> <!-- WARNING: this assumes SOAP 1.2 --> <xsl:text>http://www.w3.org/2003/05/soap/mep/request-response/</xsl:text> </xsl:when> <xsl:otherwise> <!-- This is an error and will be reported in checkSoapHTTPMethod --> <xsl:text>(No MEP specified for </xsl:text> <xsl:value-of select='$msgRef/../../cm:messageExchangePattern'/> <xsl:text>)</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name='getSoapHTTPMethod'> <xsl:param name='msgRef'/> <xsl:param name='bindingRef'/> <xsl:variable name='direction' select='$msgRef/cm:direction'/> <xsl:variable name='soapMep'> <xsl:call-template name='getSoapMEP'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> </xsl:call-template> </xsl:variable> <xsl:variable name='soapVersion'> <xsl:call-template name='getSoapVersion'> <xsl:with-param name='bindingRef' select='$bindingRef'/> </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:text>@@OOPS</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name='checkSoapHTTPMethod'> <xsl:param name='msgRef'/> <xsl:param name='bindingRef'/> <xsl:param name='xmessage'/> <xsl:variable name='direction' select='$msgRef/cm:direction'/> <xsl:variable name='soapMep'> <xsl:call-template name='getSoapMEP'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> </xsl:call-template> </xsl:variable> <xsl:variable name='soapVersion'> <xsl:call-template name='getSoapVersion'> <xsl:with-param name='bindingRef' select='$bindingRef'/> </xsl:call-template> </xsl:variable> <xsl:call-template name='generate-assertion'> <xsl:with-param name='xpath'> <xsl:value-of select='$xmessage'/> <xsl:text>/l:httpHeaders</xsl:text> <xsl:choose> <xsl:when test='$direction="in" and $soapMep="http://www.w3.org/2003/05/soap/mep/soap-response/"'> <xsl:text>/l:Method[@value='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>/l:Method[@value='POST']</xsl:text> </xsl:when> <xsl:when test='$direction="in"'> <xsl:message>Unknown SOAP MEP <xsl:value-of select='$soapMep'/></xsl:message> <xsl:text>/l:Method[@value='@@UNKNOWN']</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='checkSoapHTTPContentType'> <xsl:param name='msgRef'/> <xsl:param name='bindingRef'/> <xsl:param name='xmessage'/> <xsl:variable name='direction' select='$msgRef/cm:direction'/> <xsl:variable name='soapMep'> <xsl:call-template name='getSoapMEP'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </xsl:call-template> </xsl:variable> <xsl:variable name='soapVersion'> <xsl:call-template name='getSoapVersion'> <xsl:with-param name='bindingRef' select='$bindingRef'/> </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='$xmessage'/> <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='checkSoapHTTPSOAPAction'> <xsl:param name='msgRef'/> <xsl:param name='bindingRef'/> <xsl:param name='xmessage'/> <xsl:variable name='direction' select='$msgRef/cm:direction'/> <xsl:variable name='soapVersion'> <xsl:call-template name='getSoapVersion'> <xsl:with-param name='bindingRef' select='$bindingRef'/> </xsl:call-template> </xsl:variable> <xsl:if test='$direction="in" and $bindingRef/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='$xmessage'/> <xsl:text>/l:httpHeaders/l:SOAPAction = '</xsl:text> <xsl:if test='$soapVersion="1.1"'> <xsl:text>"</xsl:text> </xsl:if> <xsl:value-of select='$bindingRef/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='checkSoapEnvelope'> <xsl:param name='msgRef'/> <xsl:param name='bindingRef'/> <xsl:param name='xmessage'/> <xsl:variable name='direction' select='$msgRef/cm:direction'/> <xsl:variable name='soapMep'> <xsl:call-template name='getSoapMEP'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </xsl:call-template> </xsl:variable> <xsl:variable name='soapVersion'> <xsl:call-template name='getSoapVersion'> <xsl:with-param name='bindingRef' select='$bindingRef'/> </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='$xmessage'/> <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='checkSoapBody'> <xsl:param name='msgRef'/> <xsl:param name='bindingRef'/> <xsl:param name='xmessage'/> <xsl:variable name='direction' select='$msgRef/cm:direction'/> <xsl:variable name='soapMep'> <xsl:call-template name='getSoapMEP'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </xsl:call-template> </xsl:variable> <xsl:variable name='msgCModel' select='$msgRef/cm:messageContentModel'/> <xsl:variable name='soapVersion'> <xsl:call-template name='getSoapVersion'> <xsl:with-param name='bindingRef' select='$bindingRef'/> </xsl:call-template> </xsl:variable> <!-- Construct the path to the soap body --> <xsl:variable name='body'> <xsl:value-of select='$xmessage'/> <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", $msgRef/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.xsl --- <?xml version="1.0" encoding="utf-8"?> <!-- $Header: /sources/public/2002/ws/desc/test-suite/messages/generate-xpath-assertions.xsl,v 1.1 2006/10/24 16:53:09 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: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'> <xsl:output method="xml" indent="yes" /> <xsl:include href='generate-xpath-assertions-soap.xsl'/> <xsl:key name='xmlId' match='*' use='@xml:id'/> <xsl:template match='/'> <xsl:element name='stylesheet' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:attribute name='version'>1.0</xsl:attribute> <xsl:element name='output' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:attribute name='method'>xml</xsl:attribute> <xsl:attribute name='indent'>yes</xsl:attribute> </xsl:element> <xsl:element name='template' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:attribute name='match'>/</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:apply-templates select='/cm:descriptionComponent/cm:bindings/cm:bindingComponent'/> <!-- <xsl:apply-templates select='key("xmlId", "id-2110471850")'/> --> </div> </body> </html> </xsl:element> </xsl:element> </xsl:template> <xsl:template match='cm:bindingComponent'> <xsl:variable name='bindingRef' select='.'/> <xsl:variable name='interfaceOpComp' select='key("xmlId", cm:interfaceOperation/@ref)'/> <h2><xsl:text>Interface </xsl:text> <xsl:value-of select='cm:name/cmbase:namespaceName'/> <xsl:text>{</xsl:text> <xsl:value-of select='cm:name/cmbase:localName'/> <xsl:text>}</xsl:text></h2> <xsl:apply-templates select='cm:bindingOperations/cm:bindingOperationComponent'/> </xsl:template> <xsl:template match='cm:bindingOperationComponent'> <xsl:variable name='bindingRef' select='.'/> <xsl:variable name='interfaceOpComp' select='key("xmlId", cm:interfaceOperation/@ref)'/> <h3><xsl:text>Operation </xsl:text> <xsl:value-of select='$interfaceOpComp/cm:name/cmbase:namespaceName'/> <xsl:text>{</xsl:text> <xsl:value-of select='$interfaceOpComp/cm:name/cmbase:localName'/> <xsl:text>}</xsl:text></h3> <xsl:variable name='position'> <xsl:for-each select='$interfaceOpComp/../cm:interfaceOperationComponent'> <xsl:if test='@xml:id=$interfaceOpComp/@xml:id'> <xsl:value-of select='position()-1'/> </xsl:if> </xsl:for-each> </xsl:variable> <!-- <xsl:choose> <xsl:when test='$interfaceOpComp/cm:messageExchangePattern="http://www.w3.org/2006/01/wsdl/in-out"'> <assertion><xsl:text>/l:log/l:message[@number='</xsl:text> <xsl:value-of select='2*$position + 1'/><xsl:text>']/@type[text()='request']</xsl:text></assertion> <assertion><xsl:text>/l:log/l:message[@number='</xsl:text> <xsl:value-of select='2*$position + 2'/><xsl:text>']/@type[text()='response']</xsl:text></assertion> </xsl:when> <xsl:when test='$interfaceOpComp/cm:messageExchangePattern="http://www.w3.org/2006/01/wsdl/in"'> <assertion><xsl:text>/l:log/l:message[@number='</xsl:text> <xsl:value-of select='2*$position + 1'/><xsl:text>']/@type[text()='request']</xsl:text></assertion> </xsl:when> </xsl:choose> --> <xsl:for-each select='$interfaceOpComp/cm:interfaceMessageReferences/cm:interfaceMessageReferenceComponent'> <xsl:call-template name='MessageRef'> <xsl:with-param name='msgRef' select='.'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='position'> <xsl:choose> <xsl:when test='cm:direction="in"'> <xsl:value-of select='2*$position + 1'/> </xsl:when> <xsl:when test='cm:direction="out"'> <xsl:value-of select='2*$position + 2'/> </xsl:when> <xsl:otherwise> <xsl:text>@@InvalidDirection</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:with-param> </xsl:call-template> </xsl:for-each> </xsl:template> <xsl:template match='*'> </xsl:template> <xsl:template name='MessageRef'> <xsl:param name='msgRef'/> <xsl:param name='bindingRef'/> <xsl:param name='position'/> <xsl:variable name='direction' select='$msgRef/cm:direction'/> <xsl:variable name='xmessage'> <xsl:text>/l:log/l:message[@number='</xsl:text> <xsl:value-of select='$position'/> <xsl:text>']</xsl:text> </xsl:variable> <div class='message'> <p class='message' style='font-weight: bold'> <xsl:text>Message </xsl:text> <span class='direction'><xsl:value-of select='$direction' /></span> <span class='position'><xsl:value-of select='$position' /></span> <xsl:element name='choose' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:element name='when' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:attribute name='test'> <xsl:value-of select='$xmessage'/> <xsl:text>/@timestamp</xsl:text> </xsl:attribute> <xsl:text> @ </xsl:text> <code class='timestamp'><xsl:element name='value-of' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:attribute name='select'> <xsl:value-of select='$xmessage'/> <xsl:text>/@timestamp</xsl:text> </xsl:attribute> </xsl:element></code> </xsl:element> <xsl:element name='otherwise' namespace='http://www.w3.org/1999/XSL/Transform'> <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'> <xsl:value-of select='$xmessage'/> <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'> <xsl:value-of select='$xmessage'/> <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'> <xsl:value-of select='$xmessage'/> <xsl:text>/l:receiverHostAndPort</xsl:text> </xsl:attribute> <xsl:text> ⇨ </xsl:text> <code class='to'><xsl:element name='value-of' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:attribute name='select'> <xsl:value-of select='$xmessage'/> <xsl:text>/l:receiverHostAndPort</xsl:text> </xsl:attribute> </xsl:element></code> <xsl:text>]</xsl:text> </xsl:element> </p> <xsl:element name='if' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:attribute name='test'> <xsl:value-of select='$xmessage'/> </xsl:attribute> <xsl:comment> # # Now checking "<xsl:value-of select='$direction'/>" message <xsl:value-of select='$xmessage'/> # </xsl:comment> <xsl:choose> <xsl:when test='$direction="in"'> <xsl:call-template name='generate-assertion'> <xsl:with-param name='xpath'> <xsl:value-of select='$xmessage'/><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='$xmessage'/><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:if test='$bindingRef/../../cm:type="http://www.w3.org/2006/01/wsdl/soap"'> <xsl:call-template name='checkSoap'> <xsl:with-param name='msgRef' select='$msgRef'/> <xsl:with-param name='bindingRef' select='$bindingRef'/> <xsl:with-param name='xmessage' select='$xmessage'/> </xsl:call-template> </xsl:if> </xsl:element> </div> </xsl:template> <xsl:template name='generate-assertion'> <xsl:param name='xpath'/> <xsl:param name='description'>No description available</xsl:param> <xsl:element name='choose' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:element name='when' namespace='http://www.w3.org/1999/XSL/Transform'> <xsl:attribute name="test"> <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='otherwise' namespace='http://www.w3.org/1999/XSL/Transform'> <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>
Received on Tuesday, 24 October 2006 16:53:22 UTC