source: sandbox/expresso-solr/solr/example/example-DIH/solr/db/conf/xslt/example_atom.xsl @ 7588

Revision 7588, 2.4 KB checked in by adir, 11 years ago (diff)

Ticket #000 - Adicionando a integracao de buscas com Solr na base a ser isnerida na comunidade

Line 
1<?xml version='1.0' encoding='UTF-8'?>
2
3<!--
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements.  See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License.  You may obtain a copy of the License at
10 *
11 *     http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 -->
19
20<!--
21  Simple transform of Solr query results to Atom
22 -->
23
24<xsl:stylesheet version='1.0'
25    xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
26
27  <xsl:output method="xml" encoding="utf-8" />
28
29  <xsl:template match='/'>
30    <xsl:variable name="query" select="response/lst[@name='responseHeader']/lst[@name='params']/str[@name='q']"/>
31    <feed xmlns="http://www.w3.org/2005/Atom">
32      <title>Example Solr Atom 1.0 Feed</title>
33      <subtitle>
34       This has been formatted by the sample "example_atom.xsl" transform -
35       use your own XSLT to get a nicer Atom feed.
36      </subtitle>
37      <author>
38        <name>Apache Solr</name>
39        <email>solr-user@lucene.apache.org</email>
40      </author>
41      <link rel="self" type="application/atom+xml"
42            href="http://localhost:8983/solr/q={$query}&amp;wt=xslt&amp;tr=atom.xsl"/>
43      <updated>
44        <xsl:value-of select="response/result/doc[position()=1]/date[@name='timestamp']"/>
45      </updated>
46      <id>tag:localhost,2007:example</id>
47      <xsl:apply-templates select="response/result/doc"/>
48    </feed>
49  </xsl:template>
50   
51  <!-- search results xslt -->
52  <xsl:template match="doc">
53    <xsl:variable name="id" select="str[@name='id']"/>
54    <entry>
55      <title><xsl:value-of select="str[@name='name']"/></title>
56      <link href="http://localhost:8983/solr/select?q={$id}"/>
57      <id>tag:localhost,2007:<xsl:value-of select="$id"/></id>
58      <summary><xsl:value-of select="arr[@name='features']"/></summary>
59      <updated><xsl:value-of select="date[@name='timestamp']"/></updated>
60    </entry>
61  </xsl:template>
62
63</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.