<?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/overviewpatterns.xsl,v 1.17 2007/04/19 11:17:25 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:param name="examplesPath">../../../examples/6/09/</xsl:param>
    <xsl:param name="w3c.root">../../../../../../</xsl:param>
    <xsl:variable name="examples" select="document('examples.xml')/ex:examples"/>
    <xsl:variable name="sep" select="'/'"/>
    <xsl:variable name="detectedPatterns" select="document(concat($examplesDir,$sep,'examples-patterns.xml'))/detected-patterns"/>

  <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>XML Schema Patterns for Databinding</title>
    <link type="text/css" rel="stylesheet" href="{$w3c.root}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> XML Schema Patterns for Databinding </h1>
    </div>

	<table border="1">
	    <tr>
		<th>Pattern</th>
		<th>Status</th>
		<th>Group</th>
		<th>Issue</th>
		<th>Example</th>
	    </tr>
	    <xsl:for-each select="//pat:pattern">
		<xsl:variable name="patternId" select="./@xml:id"/>

		<xsl:variable name="exampleId">
		  <xsl:choose>
		   <xsl:when test="$examples/ex:example[@pattern = $patternId]">
		     <xsl:value-of select="$examples/ex:example[@pattern = $patternId][1]/@xml:id"/>
		   </xsl:when>
		   <xsl:otherwise>
		    <xsl:value-of select="./@xml:id"/>
		   </xsl:otherwise>
		  </xsl:choose>
		</xsl:variable>

		<tr id="{$patternId}">
		    <td>
			<a name="{./@xml:id}"></a><a href="{./@xml:id}"><xsl:value-of select="./@xml:id"/></a>
		    </td>
		    <td>
	<!-- worried about basic! -->
			<xsl:if test="@status = 'basic'">
			<xsl:choose>
			    <xsl:when test="$detectedPatterns/example[@xml:id=$exampleId]/detected/pattern[@name=$patternId]">
			       <xsl:attribute name="bgcolor">#88FF88</xsl:attribute>
			    </xsl:when>
			    <xsl:when test="$detectedPatterns/example/detected/pattern[@name=$patternId]">
			       <xsl:attribute name="bgcolor">#FFFF88</xsl:attribute>
			    </xsl:when>
			    <xsl:otherwise>
			       <xsl:attribute name="bgcolor">#FF8888</xsl:attribute>
			    </xsl:otherwise>
			</xsl:choose>
			</xsl:if>

			<xsl:choose>
			  <xsl:when test="@status = 'basic' or @status = 'advanced'">
			    <a href="../../../edcopy/{@status}/{@status}.html#pattern-{$patternId}"><xsl:value-of select="@status"/></a>
			  </xsl:when>
			  <xsl:otherwise>
			    <xsl:value-of select="@status"/>
			  </xsl:otherwise>
			</xsl:choose>
		    </td>
		    <td>
			<xsl:value-of select="./@groupid"/>
		    </td>
		    <td>
		      <xsl:choose>
			<xsl:when test="starts-with(@origin, 'ISSUE-')">
			    <a href="http://www.w3.org/2002/ws/databinding/issues/{substring-after(./@origin, 'ISSUE-')}"><xsl:value-of select="./@origin"/></a>
			</xsl:when>
			<xsl:when test="@origin = 'input'">
			     <a href="http://www.w3.org/2005/07/xml-schema-patterns.html">input</a>
			</xsl:when>
			<xsl:otherwise>
			    <xsl:value-of select="@origin"/>
			</xsl:otherwise>
		      </xsl:choose>
		    </td>
		    <td>
			<xsl:choose>
			    <xsl:when test="$detectedPatterns/example[@xml:id=$exampleId]/detected/pattern[@name=$patternId]">
			       <xsl:attribute name="bgcolor">#88FF88</xsl:attribute>
			    </xsl:when>
			    <xsl:when test="$detectedPatterns/example/detected/pattern[@name=$patternId]">
			       <xsl:attribute name="bgcolor">#FFFF88</xsl:attribute>
			    </xsl:when>
			    <xsl:otherwise>
			       <xsl:attribute name="bgcolor">#FF8888</xsl:attribute>
			    </xsl:otherwise>
			</xsl:choose>
			<xsl:if test="$examples/ex:example[@xml:id = $patternId]">
			    <a href="{$examplesPath}{$patternId}/"><xsl:value-of select="$patternId"/></a>
			</xsl:if>
			<xsl:if test="$examples/ex:example[@pattern = $patternId]">
			<xsl:for-each select="$examples/ex:example[@pattern = $patternId]">

			    [<a href="{$examplesPath}{./@xml:id}/"><xsl:value-of select="./@xml:id"/></a>]
			</xsl:for-each>
			</xsl:if>

		    </td>
		</tr>
	    </xsl:for-each>
        </table>

	<h2 id="detector">Detecting Patterns</h2>
	    <p>The <a href="http://www.w3.org/TR/xslt20/">XSLT 2.0</a> stylesheet [<a href="patternsdetector.xsl">patternsdetector.xsl</a>] reports the patterns detected in an XML Schema or WSDL document, marking additional elements as being "unknown".</p>
	    <p>The <a href="http://www.w3.org/TR/xslt">XSLT 1.0</a> stylesheet [<a href="detected.xsl">detected.xsl</a>] transforms the patterns detector output into HTML.</p>
	    <p>Caveat: imported and included schemas are currently ignored.</p>
    <hr/>
    <xsl:copy-of select="document('address.xml')/suffix/*"/>
    <p>Generated from <a href="patterns.xml">patterns.xml</a> &#x24;Date$</p>

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

</xsl:stylesheet>
