<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:uddi="urn:uddi-org:api_v2"
       xmlns:scripts ="http://architag.com/scripts" 
      xmlns:msxsl="urn:schemas-microsoft-com:xslt"
      xmlns:html="http://www.w3.org/1999/xhtml"
     xmlns:xlink="http://www.w3.org/1999/xlink"> 
  <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" omit-xml-declaration="yes"
      doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
     />
<!-- XSL programming environment for TWiki.                                      -->
<!-- <?xml ... header contains file menu to allow you to load your file for edit !  -->
<!--  -->
<!-- known problems:-->
<!-- Clipboard access to content will promote one-off environment-->
<!-- 
    This is alpha code of a compact XML manipulation tool. 
    Copyright (c) 2003 Forth Party software
    Please send comments to: JCoe18@excite.com



-->
  <xsl:strip-space elements="books"/>

  <xsl:include href="..\XslWiki\amazon.xsl"/>
  <xsl:include href="..\XslWiki\google.xsl"/>
  <xsl:include href="..\XslWiki\uddi.xsl"/>
  <xsl:include href="RSSwiki.xsl"/>
  <xsl:include href="..\XslWiki\foaf.xsl"/>

<xsl:param name="qs" select='qs'/>

<!-- Display width (pixels) -->
<xsl:variable name="display-width" select="'700'"/>

<!-- Background color (#rgb) -->
<xsl:variable name="background-color" select="'#D0F0D0'"/>

<!-- Use table separator (yes/no) -->
<xsl:variable name="use-table-separator" select="'yes'"/>

<!-- Use record separator (yes/no) -->
<xsl:variable name="use-record-separator" select="'no'"/>

<!-- ************************************************************************************** -->
<!-- Name/Sex Table                                                                         -->
<!-- ************************************************************************************** -->

<!-- Name background color (#rgb) -->
<xsl:variable name="name-bg-color" select="'#A0D0A0'"/>

<!-- Name text style (style) -->
<xsl:variable name="name-text-style" select="'font: 10pt Verdana,Arial; font-style: bold'"/>

<!-- Table padding (value) -->
<xsl:variable name="name-padding" select="2"/>

<!-- Table spacing (value) -->
<xsl:variable name="name-spacing" select="0"/>

<!-- Table border (value) -->
<xsl:variable name="name-border" select="0"/>

<!-- Show sex (yes/no) -->
<xsl:variable name="show-sex" select="'yes'"/>

<!-- Show name suffix/title (yes/no) -->
<xsl:variable name="show-suffix" select="'yes'"/>

<!-- ************************************************************************************** -->
<!-- Events/Facts Table                                                                     -->
<!-- ************************************************************************************** -->

<!-- Event/Fact table color (#rgb) -->
<xsl:variable name="fact-table-color" select="'#D0F0D0'"/>

<!-- Text style (style) -->
<xsl:variable name="fact-text-style" select="'font: 9pt Verdana,Arial'"/>

<!-- Table padding (value) -->
<xsl:variable name="fact-padding" select="1"/>

<!-- Table spacing (value) -->
<xsl:variable name="fact-spacing" select="0"/>

<!-- Table border (value) -->
<xsl:variable name="fact-border" select="4"/>


<!-- ************************************************************************************** -->
<!-- Parent(s) Table                                                                        -->
<!-- ************************************************************************************** -->

<!-- Parents table background color (#rgb) -->
<xsl:variable name="parent-table-color" select="'#D0F0D0'"/>

<!-- Text style (style) -->
<xsl:variable name="parent-text-style" select="'font: 9pt Verdana,Arial'"/>

<!-- Table padding (value) -->
<xsl:variable name="parent-padding" select="1"/>

<!-- Table spacing (value) -->
<xsl:variable name="parent-spacing" select="0"/>

<!-- Table border (value) -->
<xsl:variable name="parent-border" select="0"/>

<!-- ************************************************************************************** -->
<!-- Family Table                                                                           -->
<!-- ************************************************************************************** -->

<!-- Family table background color (#rgb) -->
<xsl:variable name="family-table-color" select="'#D0F0D0'"/>

<!-- Text style (style) -->
<xsl:variable name="family-text-style" select="'font: 9pt Verdana,Arial'"/>

<!-- Table padding (value) -->
<xsl:variable name="family-padding" select="1"/>

<!-- Table spacing (value) -->
<xsl:variable name="family-spacing" select="0"/>

<!-- Table border (value) -->
<xsl:variable name="family-border" select="3"/>


<xsl:variable name="LocalPage" select="document('')"/>
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
   
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 2007 08:21:57 GMT"/>

        <style>
          .title { float:left; text-align:center; border:1px solid black; margin: 1em; padding: 1em; width: 12em; background-color:#eee } 
          .title p { text-align:center }
        </style>
  <script type="text/jscript">
	<xsl:comment>
		<![CDATA[
			var seq = 1;
			var exp = null;
			var ys = 0.0;
	 		
			function moveText(t)
			{try {	var e; var p; var r;
				var oldValue = document.getElementById("old");
				var newValue =  document.getElementById("new");
				var wikiSource =  document.getElementById("hiddenSource");
				newValue.value = oldValue.value;
				window.status="XslWiki loaded";								                  wikiSource.style.display = "none";
			     }catch(exception) { window.status="XslWiki error:"+exception.description }
			}
				function ESC_KeyDown()
							{
								//window.status= event.keyCode ;
								if( 27 == event.keyCode )
								{
									self.close();
								}
							}

						]]>
					</xsl:comment>
				</script>
 <xsl:call-template name="get-wiki-head"><xsl:with-param name="title" select="."/></xsl:call-template>

      </head>
      <body>  <xsl:attribute name="onload">moveText(this)</xsl:attribute>

         <a name="PageTop"></a>
     
          <xsl:call-template name="get-rss"><xsl:with-param name="title" select="."/>
           </xsl:call-template>
         <xsl:call-template name="get-wiki"><xsl:with-param name="title" select="."/>
      </xsl:call-template>
        <xsl:apply-templates/>
 <!-- End of page ,
-->
        <a name="PageBottom"></a>
      </body>
    </html>
  </xsl:template>

  <!-- Matches a <title> element in the input document -->
<xsl:template match="title">
   <xsl:element name="table">
         <xsl:attribute name="border">2</xsl:attribute>
        <xsl:attribute name="width"><xsl:value-of select="$display-width"/></xsl:attribute>
        <xsl:attribute name="cellpadding"><xsl:value-of select="$family-padding"/></xsl:attribute>
        <xsl:attribute name="cellspacing"><xsl:value-of select="$family-spacing"/></xsl:attribute>
        <xsl:attribute name="border"><xsl:value-of select="$family-border"/></xsl:attribute>
        <xsl:attribute name="bgcolor"><xsl:value-of select="$family-table-color"/></xsl:attribute>

 <xsl:call-template name="get-uddi"><xsl:with-param name="title" select="."/>
      </xsl:call-template>
   
   
<TR><TD>  
      <a href="http://validator.w3.org/check/referer">
         <img  src="http://www.w3.org/Icons/valid-xhtml10"
          alt="Valid XHTML 1.0!" height="31" width="88" /></a>
   
    <!-- Get the author of the title -->
    <xsl:variable name="author">
      <xsl:call-template name="get-author">
        <xsl:with-param name="title" select="."/>
      </xsl:call-template>
    </xsl:variable>
   
     <!-- Get the rdf appended search string-->
    <xsl:variable name="rdf">
        <xsl:value-of select="."/> rdf:RDF
      
    </xsl:variable>
    <!-- Get an image of the book -->    
    <xsl:variable name="image">
      <xsl:call-template name="get-image">
        <xsl:with-param name="title" select="."/>
      </xsl:call-template>
    </xsl:variable>
   </TD><TD>
    <!-- Get a url based on the title -->
    <xsl:variable name="url">
      <xsl:call-template name="feeling-lucky">
        <xsl:with-param name="search-term" select="."/>
      </xsl:call-template>
    </xsl:variable>
    </TD><TD>
    <!-- Get a url based on the author's name$author -->
    <xsl:variable name="urlA">
      <xsl:call-template name="feeling-lucky">
        <xsl:with-param name="search-term" select="$author "/>
      </xsl:call-template>
    </xsl:variable>

    <!-- Display the author name and link -->
    
      <p>
        <img>
          <xsl:attribute name="src">
            <xsl:value-of select="$image"/>
          </xsl:attribute>
        </img>
      </p>
     </TD><TD>
      <p>
        <td> <a> <xsl:attribute name="title">
                        <xsl:value-of select="$urlA"/></xsl:attribute>
          <xsl:attribute name="href">
            <xsl:value-of select="$url"/>
          </xsl:attribute>
          <xsl:value-of select="."/>

        </a></td>
      </p>
      </TD><TD>
      <p>
        <a><xsl:attribute name="title">
                        <xsl:value-of select="$url"/></xsl:attribute>
          <xsl:attribute name="href">
            <xsl:value-of select="$url"/>
          </xsl:attribute>
          <xsl:value-of select="$author"/>
        </a>
      </p><table><tr><td>
     <xsl:call-template name="six-pack">
        <xsl:with-param name="search-term" select="."/>
      </xsl:call-template>
       </td>
       <td>
     <xsl:call-template name="six-pack-plus">
        <xsl:with-param name="search-term" select="$rdf"/>
      </xsl:call-template>
       </td>
       </tr>
      </table>
 
</TD></TR>
    </xsl:element>
  </xsl:template>


 <msxsl:script implements-prefix="scripts" language="JavaScript1.2" > 

   <![CDATA[ 
//      var WikiNameRegexp = '^([A-Za-z0-9])([A-Z][a-z]+){2,}(?![A-Za-z0-9])';
      var g_obj = new Array();
      var wikiNS = 'http://twiki.org/cgi-bin/view/';
      var wikiBranch = 'Main/';
      var parts;
      var seqTextArea = 0;
             function tget(p){ 
             return parts[p];
}
function getLoc() { return history.length;}
function tname(ctx){ 
          var tmp;
	seqTextArea++;
           if(seqTextArea == 1) return "old";
           return "new";
}
    function findTopics(ctx){ 
          var tmp;
          var tmp2;
         // var idVal = ctx.getAttribute("id");

          var replaceText = ctx.nextNode().text;
   //      replaceText = replaceText.replace(WikiNameRegexp, '%ICON{"xml"}% ');
var tdom = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");// THIS LINE MAKE CODE IE DEPENDANT
           var od = tdom.createNode(1, 'myRE', '');

  parts = replaceText.split('[[');
	if (parts  != null){
		//
		for (var i=1; i < parts.length; i++){
		   
                                         
		     tmp2 = parts[i].split(']');
		    
		     if(tmp2.length > 1)
                                         {    tmp=tmp2[1].indexOf(']');
		         var tmp3 =  tmp2[1].substring(1,tmp);
			 tmp2[0].replace(/%ATTACHURL%/g, wikiNS + wikiBranch );
                                                   var mn = tdom.createNode(1, 'h2', '');
			var tn = tdom.createTextNode("bb"+tmp3);
			mn = od.appendChild(mn);
			tn = mn.appendChild(tn);
			mn = tdom.createNode(1, 'h1', '');
			var tn = tdom.createTextNode(tmp2[0]);
			mn = od.appendChild(mn);
			tn = mn.appendChild(tn);
                                          //   count = count + 1;
		     }

		}
                  }
              parts = replaceText.split('---++++++');
	if (parts  != null){
		//
		for (var i=1; i < parts.length; i++){
			//window.status =window.status + parts[i];
			tmp=parts[i].split('/n');

			var mn = tdom.createNode(1, 'h2', '');
			var tn = tdom.createTextNode(tmp[1]);
			mn = od.appendChild(mn);
			tn = mn.appendChild(tn);
			mn = tdom.createNode(1, 'h1', '');
			var tn = tdom.createTextNode(tmp[0]);
			mn = od.appendChild(mn);
			tn = mn.appendChild(tn);
			g_obj[i] = tmp[0];
		}
		//
    for (var i=1; i < g_obj.length; i++){
	//window.status =window.status + parts[i];
	tmp2=tmp2 + ' ' +g_obj[i]; 

           }
                                     mn = tdom.createNode(1, 'h1', '');
		var tn = tdom.createTextNode(tmp2);
		mn = od.appendChild(mn);
		tn = mn.appendChild(tn);
		
		return od.selectNodes("*");
	}
}
function topicGroup(ctx){ 
          var tmp='';
          var st='';
          var replaceText = ctx.nextNode().text;
         replaceText = replaceText.replace(WikiNameRegexp, '%ICON{"xml"}% ');
          for (var i=1; i < g_obj.length; i++){
	//window.status =window.status + parts[i];
	tmp=tmp + ' ' +g_obj[i]; 

           }
           tmp = tmp.replace('/n ', ' ');
           tmp = tmp.replace('/n ', ' ');
      tmp = tmp.replace('          ', ' ');
           tmp = tmp.replace('    ', ' ');
           tmp = tmp.replace('     ', ' ');
           tmp = tmp.replace('  ', ' ');
           return tmp;
}

 
function   _wander(ctx){
	var retStr = "";
	for (var i=0; i < ctx.childNodes.length; i++){
		ctxN = ctx.childNodes[i];
		switch(ctxN.nodeType){
			case 1:
				retStr +=   _wander(ctxN);
				break;
			case 3:
				retStr += ctxN.nodeValue;
				break;
			default:
				break;
		}
	}
	return retStr;
}
    function showXML(nodelist)
           {
           txtResult = "<SPAN "+
               "STYLE='background-color:lightyellow;" +
               "cursor:hand;font-size:8pt;' " +
               "TITLE='"
           replaceText = nodelist.nextNode().xml
           replaceText = replaceText.replace(/&/g, '&amp;')
           replaceText = replaceText.replace(/</g, '&lt;')
           replaceText = replaceText.replace(/>/g, '&gt;')
           replaceText = replaceText.replace(/'/g, '&rsquo;')
           txtResult += replaceText
           txtResult += "'>(show xml)</SPAN>"
           return txtResult;
           }
  function findItems(nodelist)
           {
        
           var replaceText = nodelist.nextNode().xml;
            replaceText = replaceText.replace(WikiNameRegexp, '%ICON{"xsl"}% ');
           replaceText = replaceText.replace(/ ---/g, '%ICON{"xml"}% ');
     
         
           return replaceText;
           }


  ]]> 

</msxsl:script>

</xsl:stylesheet>

