- From: Philippe Le Hegaret via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 19 Oct 2006 14:41:43 +0000
- To: public-ws-desc-eds@w3.org
Update of /sources/public/2002/ws/desc/test-suite/messages In directory hutz:/tmp/cvs-serv11839 Added Files: ws-i.xsl Log Message: New --- NEW FILE: ws-i.xsl --- <?xml version="1.0" encoding="UTF-8"?> <!-- $Header: /sources/public/2002/ws/desc/test-suite/messages/ws-i.xsl,v 1.1 2006/10/19 14:41:40 plehegar Exp $ Convert WS-I Monitor file into WS-Addressing Log file --> <xsl:stylesheet version="1.0" xmlns:l="http://www.w3.org/2002/ws/addressing/logs/" xmlns:http="http://www.w3.org/2002/ws/addressing/logs/http" 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/"> <xsl:output method="xml" indent="yes"/> <xsl:variable name="bom"><?xml</xsl:variable> <xsl:variable name="gone"><?_xml</xsl:variable> <xsl:template match="wsi-log303:log"> <l: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-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-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-log407:messageContent"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <l:message timestamp="{@timestamp}" conversation="{@conversationID}" wsi-log303:ID="{@ID}" type="{@type}"> <xsl:copy-of select="wsi-log303:senderHostAndPort"/> <xsl:copy-of select="wsi-log303:receiverHostAndPort"/> <l:httpHeaders> <xsl:call-template name='replaceHeaders'> <xsl:with-param name="text" select="wsi-log303:httpHeaders"/> </xsl:call-template> </l:httpHeaders> <l:content> <xsl:value-of select="$content" disable-output-escaping="yes"/> </l:content> </l:message> </xsl:for-each> </l:log> </xsl:template> <xsl:template match="wsi-log407:log"> <l: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> <l:message timestamp="{@timestamp}" conversation="{@conversationID}" wsi-log407:ID="{@ID}" type="{@type}"> <xsl:copy-of select="wsi-log407:senderHostAndPort"/> <xsl:copy-of select="wsi-log407:receiverHostAndPort"/> <l:httpHeaders> <xsl:call-template name='replaceHeaders'> <xsl:with-param name="text" select="wsi-log407:httpHeaders"/> </xsl:call-template> </l:httpHeaders> <l:content> <xsl:value-of select="$content" disable-output-escaping="yes"/> </l:content> </l:message> </xsl:for-each> </l:log> </xsl:template> <xsl:template name="replaceHeaders"> <xsl:param name='text'/> <xsl:choose> <xsl:when test='contains($text, "
")'> <xsl:call-template name='replaceHeaders'> <xsl:with-param name='text' select='substring-before($text, "
")'/> </xsl:call-template> <xsl:call-template name='replaceHeaders'> <xsl:with-param name='text' select='substring-after($text, "
")'/> </xsl:call-template> </xsl:when> <xsl:when test='starts-with($text, "HTTP/1.")'> <xsl:choose> <xsl:when test='contains($text, " 200 OK")'> <http:code value="200"><xsl:value-of select='$text'/></http:code> </xsl:when> <xsl:otherwise> <http:code><xsl:value-of select='$text'/></http:code> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test='starts-with($text, "POST ")'> <http:method value="POST"><xsl:value-of select='substring-before(substring-after($text, "POST "), " HTTP")'/></http:method> </xsl:when> <xsl:when test='starts-with($text, "GET ")'> <http:method value="GET"><xsl:value-of select='substring-before(substring-after($text, "POST "), " HTTP")'/></http:method> </xsl:when> <xsl:when test='starts-with($text, "DELETE ")'> <http:method value="DELETE"><xsl:value-of select='substring-before(substring-after($text, "POST "), " HTTP")'/></http:method> </xsl:when> <xsl:when test='contains($text, ": ")'> <xsl:variable name='name'> <xsl:value-of select='substring-before(normalize-space($text), ": ")'/> </xsl:variable> <http:header value='{$name}'> <xsl:value-of select='substring-after($text, ": ")'/> </http:header> </xsl:when> <xsl:otherwise> <xsl:value-of select='$text' disable-output-escaping="yes"/> </xsl:otherwise> </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, 19 October 2006 14:42:14 UTC