<?xml version="1.0"?>
<!-- 

    Copyright (C) 2006 W3C (R) (MIT ERCIM Keio), All Rights Reserved.
    W3C liability, trademark and document use rules apply.

    http://www.w3.org/Consortium/Legal/ipr-notice
    http://www.w3.org/Consortium/Legal/copyright-documents

    $Header: /w3ccvs/WWW/2002/ws/databinding/edcopy/patterns/overviewexamples.xsl,v 1.18 2007/04/20 14:11:35 pdowney Exp $

-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:pat="http://www.w3.org/2002/ws/databinding/patterns/6/09/"
    xmlns:ex="http://www.w3.org/2002/ws/databinding/examples/6/09/"
  version="1.0">

    <xsl:output method="html" indent="yes" encoding="UTF-8"/>

    <xsl:param name="examplesDir">../../examples/6/09/</xsl:param>
    <xsl:variable name="w3c.root">../../../../../../..</xsl:variable>
    <xsl:variable name="patterns" select="document('patterns.xml')/pat:patterns"/>
    <xsl:variable name="validation-results" select="document(concat($examplesDir, 'validation-results.xml'))/validation"/>
    <xsl:variable name="sep" select="'/'"/>

  <xsl:template match="/">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">
  <head>
    <title>Examples - XML Schema Patterns for Databinding</title>
    <link type="text/css" rel="stylesheet" href="../../../../../../StyleSheets/TR/base.css"/>
<style type="text/css">
div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }

table { empty-cells: show; }

th { color: #000000; background-color: #CCCC99; }

td { vertical-align: top; }

table caption {
	font-weight: normal;
	font-style: italic;
	text-align: left;
	margin-bottom: .5em;
}
</style>
  </head>

  <body xmlns:rddl="http://www.rddl.org/">

            <xsl:comment>

                Copyright (C) 2006 W3C (R) (MIT ERCIM Keio), All Rights Reserved.
                W3C liability, trademark and document use rules apply.
            
                http://www.w3.org/Consortium/Legal/ipr-notice
                http://www.w3.org/Consortium/Legal/copyright-documents
            
		<xsl:value-of select="ex:version"/>

            </xsl:comment>

    <div class="head">
      <p>
        <a href="http://www.w3.org/">
	  <img width="72" height="48" alt="W3C" src="{$w3c.root}/Icons/w3c_home"/>
	</a>
      </p>
	

      <h1> Examples </h1>
    </div>

	<ul>
	    <li><a href="examples.xsd">examples.xsd</a> - all of the example schemata in a single XML Schema 1.0 document</li>
	    <li><a href="examples2wsdl.xsl">examples2wsdl.xsl</a> - stylesheet to select examples to build a WSDL 1.1 document</li>
	    <li><a href="examples.wsdl">examples.wsdl</a> - all of the example schemata in a single WSDL 1.1 document</li>
	    <li><a href="examples-soap11.xml">examples-soap11.xml</a> - all of the example instance documents as a sequence of SOAP 1.1 messages</li>
	    <li><a href="examples-soap12.xml">examples-soap12.xml</a> - all of the example instance documents as a sequence of SOAP 1.2 messages</li>
	</ul>

	<h2>Example Schemas</h2>

	<table border="1">
	    <tr>
		<th>Example</th>
		<th>Pattern</th>
		<th>Expected<br/>Status</th>
		<th>Detected<br/>Status</th>
	    </tr>
	    <xsl:for-each select="//ex:example">
		<xsl:variable name="exampleId" select="./@xml:id"/>
		<xsl:variable name="patternId" select="./@pattern | ./@xml:id"/>
		<xsl:variable name="detectedFilename" select="concat($exampleId, $sep, $exampleId, '-patterns.xml')"/>

		<xsl:variable name="expectedStatus" select="$patterns/pat:pattern[@xml:id = $patternId]/@status"/>
		<xsl:variable name="detectedStatus" select="document(concat($examplesDir, $detectedFilename))/detected/@status"/>

		<tr id="{$exampleId}">
		    <td>
			<a name="{./@xml:id}"></a><a href="{./@xml:id}"><xsl:value-of select="./@xml:id"/></a>
		    </td>
		    <td>
			<xsl:if test="$patterns/pat:pattern[@xml:id = $patternId]">
			   <a href="../../../patterns/6/09/{$patternId}"><xsl:value-of select="$patternId"/></a>
			</xsl:if>
		    </td>
		    <td>
			<a href="../../../edcopy/{$expectedStatus}/{$expectedStatus}.html#example-{$exampleId}"><xsl:value-of select="$expectedStatus"/></a>
		    </td>
		    <td>
			<xsl:attribute name="bgcolor">
			<xsl:choose>
			    <xsl:when test="$detectedStatus = $expectedStatus">#88FF88</xsl:when>
			    <xsl:when test="not($expectedStatus)">#FFFFFF</xsl:when>
			    <xsl:otherwise>#FF8888</xsl:otherwise>
			</xsl:choose>
			</xsl:attribute>
			<a href="{$exampleId}#detectedPatterns"><xsl:value-of select="$detectedStatus"/></a>
		    </td>
		</tr>
	    </xsl:for-each>
        </table>

        <h2>Example Instances</h2>

	<table border="1">
	    <tr><th>Instance</th><th>Validity</th></tr>

	    <xsl:for-each select="//ex:example">
		<xsl:variable name="exampleId" select="./@xml:id"/>
		<xsl:for-each select="ex:instance">
		    <xsl:variable name="instanceId" select="./@xml:id"/>
		    <xsl:variable name="result" select="$validation-results/result[@instance=$instanceId]"/>
		  <tr>
		    <td><a href="{$exampleId}/#{$instanceId}"><xsl:value-of select="$instanceId"/></a></td>
		    <td>
			<xsl:choose>
			   <xsl:when test="$result/@success = 'true'">
				<xsl:attribute name="bgcolor">#88FF88</xsl:attribute>
			   </xsl:when>
			   <xsl:otherwise>
				<xsl:attribute name="bgcolor">#FF8888</xsl:attribute>
				<a href="{$exampleId}/#{$instanceId}">FAILED</a>
				<!-- <code><xsl:value-of select="$result"/></code> -->
			   </xsl:otherwise>
			</xsl:choose>
		    </td>
		  </tr>
		</xsl:for-each>
	    </xsl:for-each>
        </table>


    <hr/>
    <xsl:copy-of select="document('address.xml')/suffix/*"/>
    <p>Generated from <a href="examples.xml">examples.xml</a> &#x24;Date$</p>

      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>
