| 1 | <?xml version="1.0" encoding="ISO-8859-1"?> | 
|---|
| 2 | <!-- | 
|---|
| 3 |   Licensed to the Apache Software Foundation (ASF) under one or more | 
|---|
| 4 |   contributor license agreements.  See the NOTICE file distributed with | 
|---|
| 5 |   this work for additional information regarding copyright ownership. | 
|---|
| 6 |   The ASF licenses this file to You under the Apache License, Version 2.0 | 
|---|
| 7 |   (the "License"); you may not use this file except in compliance with | 
|---|
| 8 |   the License.  You may obtain a copy of the License at | 
|---|
| 9 |    | 
|---|
| 10 |   http://www.apache.org/licenses/LICENSE-2.0 | 
|---|
| 11 |    | 
|---|
| 12 |   Unless required by applicable law or agreed to in writing, software | 
|---|
| 13 |   distributed under the License is distributed on an "AS IS" BASIS, | 
|---|
| 14 |   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|---|
| 15 |   See the License for the specific language governing permissions and | 
|---|
| 16 |   limitations under the License. | 
|---|
| 17 |    | 
|---|
| 18 |   Author     : Chris Mattmann | 
|---|
| 19 |         Auhtor     : Jérôme Charron | 
|---|
| 20 |   Description: This xsl file is used to transform dynamic properties out of the | 
|---|
| 21 |   nutch-default.xml file into a deployable Context.xml file for configuring | 
|---|
| 22 |   the Nutch war file in a servlet container. | 
|---|
| 23 | --> | 
|---|
| 24 |  | 
|---|
| 25 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | 
|---|
| 26 |  | 
|---|
| 27 | <xsl:template match="/"> | 
|---|
| 28 | <Context path="/nutch" docBase="nutch-0.9-dev.war" | 
|---|
| 29 |         debug="5" reloadable="true" crossContext="true"> | 
|---|
| 30 |  | 
|---|
| 31 | <xsl:for-each select="configuration/property"> | 
|---|
| 32 |  | 
|---|
| 33 | <!-- "searcher." properties --> | 
|---|
| 34 | <xsl:call-template name="parameter"> | 
|---|
| 35 |   <xsl:with-param name="property" select="current()"/> | 
|---|
| 36 |   <xsl:with-param name="filter" select="'searcher.'"/> | 
|---|
| 37 | </xsl:call-template> | 
|---|
| 38 |  | 
|---|
| 39 | <!-- "plugin." properties --> | 
|---|
| 40 | <xsl:call-template name="parameter"> | 
|---|
| 41 |   <xsl:with-param name="property" select="current()"/> | 
|---|
| 42 |   <xsl:with-param name="filter" select="'plugin.'"/> | 
|---|
| 43 | </xsl:call-template> | 
|---|
| 44 |  | 
|---|
| 45 | <!-- "extension.clustering." properties --> | 
|---|
| 46 | <xsl:call-template name="parameter"> | 
|---|
| 47 |   <xsl:with-param name="property" select="current()"/> | 
|---|
| 48 |   <xsl:with-param name="filter" select="'extension.clustering.'"/> | 
|---|
| 49 | </xsl:call-template> | 
|---|
| 50 |  | 
|---|
| 51 | <!-- "extension.ontology." properties --> | 
|---|
| 52 | <xsl:call-template name="parameter"> | 
|---|
| 53 |   <xsl:with-param name="property" select="current()"/> | 
|---|
| 54 |   <xsl:with-param name="filter" select="'extension.ontology.'"/> | 
|---|
| 55 | </xsl:call-template> | 
|---|
| 56 |  | 
|---|
| 57 | <!-- "query." properties --> | 
|---|
| 58 | <xsl:call-template name="parameter"> | 
|---|
| 59 |   <xsl:with-param name="property" select="current()"/> | 
|---|
| 60 |   <xsl:with-param name="filter" select="'query.'"/> | 
|---|
| 61 | </xsl:call-template> | 
|---|
| 62 |  | 
|---|
| 63 | </xsl:for-each> | 
|---|
| 64 |  | 
|---|
| 65 | </Context> | 
|---|
| 66 | </xsl:template> | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|
| 69 | <!-- | 
|---|
| 70 |  ! Template used to write out a parameter if the property's | 
|---|
| 71 |  ! name contains the specified filter string. | 
|---|
| 72 |  !--> | 
|---|
| 73 | <xsl:template name="parameter"> | 
|---|
| 74 |   <xsl:param name="property"/> | 
|---|
| 75 |   <xsl:param name="filter"/> | 
|---|
| 76 |   <xsl:if test="contains(name, $filter)"> | 
|---|
| 77 |   <Parameter override="false"> | 
|---|
| 78 |     <xsl:attribute name="name"> | 
|---|
| 79 |       <xsl:value-of select="name"/> | 
|---|
| 80 |     </xsl:attribute> | 
|---|
| 81 |     <xsl:attribute name="value"> | 
|---|
| 82 |       <xsl:value-of select="value"/> | 
|---|
| 83 |     </xsl:attribute> | 
|---|
| 84 |   </Parameter> | 
|---|
| 85 |   </xsl:if> | 
|---|
| 86 | </xsl:template> | 
|---|
| 87 |  | 
|---|
| 88 | </xsl:stylesheet>  | 
|---|