From: <bi...@us...> - 2008-10-03 23:08:35
|
Revision: 2597 http://archive-access.svn.sourceforge.net/archive-access/?rev=2597&view=rev Author: binzino Date: 2008-10-03 23:08:29 +0000 (Fri, 03 Oct 2008) Log Message: ----------- Initial revision. Added Paths: ----------- trunk/archive-access/projects/nutchwax/archive/src/web/ trunk/archive-access/projects/nutchwax/archive/src/web/style/ trunk/archive-access/projects/nutchwax/archive/src/web/style/search.xsl trunk/archive-access/projects/nutchwax/archive/src/web/web.xml Added: trunk/archive-access/projects/nutchwax/archive/src/web/style/search.xsl =================================================================== --- trunk/archive-access/projects/nutchwax/archive/src/web/style/search.xsl (rev 0) +++ trunk/archive-access/projects/nutchwax/archive/src/web/style/search.xsl 2008-10-03 23:08:29 UTC (rev 2597) @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:nutch="http://www.nutch.org/opensearchrss/1.0/" + xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" +> +<xsl:output method="xml" /> + +<xsl:template match="rss/channel"> + <html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title><xsl:value-of select="title" /></title> + <style media="all" lang="en" type="text/css"> + body + { + padding : 20px; + margin : 0; + font-family : Verdana; sans-serif; + font-size : 9pt; + color : #000000; + background-color: #ffffff; + } + .pageTitle + { + font-size : 125% ; + font-weight : bold ; + text-align : center ; + padding-bottom : 2em ; + } + .searchForm + { + margin : 20px 0 5px 0; + padding-bottom : 0px; + border-bottom : 1px solid black; + } + .searchResult + { + margin : 0; + padding : 0; + } + .searchResult h1 + { + margin : 0 0 5px 0 ; + padding : 0 ; + font-size : 120%; + } + .searchResult .details + { + font-size: 80%; + color: green; + } + .searchResult .dates + { + font-size: 80%; + } + .searchResult .dates a + { + color: #3366cc; + } + form#searchForm + { + margin : 0; padding: 0 0 10px 0; + } + .searchFields + { + padding : 3px 0; + } + .searchFields input + { + margin : 0 0 0 15px; + padding : 0; + } + input#query + { + margin : 0; + } + ol + { + margin : 5px 0 0 0; + padding : 0 0 0 2em; + } + ol li + { + margin : 0 0 15px 0; + } + </style> + </head> + <body> + <!-- Page header: title and search form --> + <div class="pageTitle" > + NutchWAX Sample XSLT + </div> + <div> + This simple XSLT demonstrates the transformation of OpenSearch XML results into a fully-functional, human-friendly HTML search page. No JSP needed. + </div> + <div class="searchForm"> + <form id="searchForm" name="searchForm" method="get" action="search" > + <span class="searchFields"> + Search for + <input id="query" name="query" type="text" size="40" value="{nutch:query}" /> + <input type="submit" value="Search"/> + </span> + </form> + </div> + <div style="font-size: 8pt; margin:0; padding:0 0 0.5em 0;">Results <xsl:value-of select="opensearch:startIndex + 1" />-<xsl:value-of select="opensearch:startIndex + opensearch:itemsPerPage" /> of about <xsl:value-of select="opensearch:totalResults" /> <span style="margin-left: 1em;"><a href="{nutch:nextPage}">Next</a></span></div> + <!-- Search results --> + <ol start="{opensearch:startIndex + 1}"> + <xsl:apply-templates select="item" /> + </ol> + <a href="{nutch:nextPage}">Next</a> + </body> +</html> +</xsl:template> + +<xsl:template match="item"> + <li> + <div class="searchResult"> + <h1><a href="{concat('http://wayback.archive-it.org/',nutch:collection,'/',nutch:date,'/',link)}"><xsl:value-of select="title" /></a></h1> + <div> + <xsl:value-of select="description" /> + </div> + <div class="details"> + <xsl:value-of select="link" /> - <xsl:value-of select="round( nutch:length div 1024 )"/>k - <xsl:value-of select="nutch:type" /> + </div> + <div class="dates"> + <a href="{concat('http://wayback.archive-it.org/',nutch:collection,'/*/',link)}">All versions</a> - <a href="?query={../nutch:query} site:{nutch:site}&hitsPerSite=0">More from <xsl:value-of select="nutch:site" /></a> + </div> + </div> + </li> +</xsl:template> + +<xsl:template match="nutch:date" > + <xsl:value-of select="substring(.,1,4)" /><xsl:text>-</xsl:text><xsl:value-of select="substring(.,5,2)" /><xsl:text>-</xsl:text><xsl:value-of select="substring(.,7,2)" /><xsl:text> </xsl:text> +</xsl:template> + +</xsl:stylesheet> Added: trunk/archive-access/projects/nutchwax/archive/src/web/web.xml =================================================================== --- trunk/archive-access/projects/nutchwax/archive/src/web/web.xml (rev 0) +++ trunk/archive-access/projects/nutchwax/archive/src/web/web.xml 2008-10-03 23:08:29 UTC (rev 2597) @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE web-app + PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<web-app> + +<!-- order is very important here --> + +<listener> + <listener-class>org.apache.nutch.searcher.NutchBean$NutchBeanConstructor</listener-class> + <listener-class>org.archive.nutchwax.NutchWaxBean$NutchWaxBeanConstructor</listener-class> +</listener> + +<servlet> + <servlet-name>Cached</servlet-name> + <servlet-class>org.apache.nutch.servlet.Cached</servlet-class> +</servlet> + +<servlet> + <servlet-name>OpenSearch</servlet-name> + <servlet-class>org.apache.nutch.searcher.OpenSearchServlet</servlet-class> +</servlet> + +<servlet-mapping> + <servlet-name>Cached</servlet-name> + <url-pattern>/servlet/cached</url-pattern> +</servlet-mapping> + +<servlet-mapping> + <servlet-name>OpenSearch</servlet-name> + <url-pattern>/opensearch</url-pattern> +</servlet-mapping> + +<servlet-mapping> + <servlet-name>OpenSearch</servlet-name> + <url-pattern>/search</url-pattern> +</servlet-mapping> + +<filter> + <filter-name>XSLT Filter</filter-name> + <filter-class>org.archive.nutchwax.XSLTFilter</filter-class> + <init-param> + <param-name>xsltUrl</param-name> + <param-value>style/search.xsl</param-value> + </init-param> +</filter> + +<filter-mapping> + <filter-name>XSLT Filter</filter-name> + <url-pattern>/search</url-pattern> +</filter-mapping> + +<welcome-file-list> + <welcome-file>search.html</welcome-file> + <welcome-file>index.html</welcome-file> + <welcome-file>index.jsp</welcome-file> +</welcome-file-list> + +<taglib> + <taglib-uri>http://jakarta.apache.org/taglibs/i18n</taglib-uri> + <taglib-location>/WEB-INF/taglibs-i18n.tld</taglib-location> + </taglib> + +</web-app> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |