1 <?xml version='1.0' encoding='UTF-8'?>
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 Simple transform of Solr query results to Atom
24 <xsl:stylesheet version='1.0'
25 xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
30 media-type="application/xml"
33 <xsl:template match='/'>
34 <xsl:variable name="query" select="response/lst[@name='responseHeader']/lst[@name='params']/str[@name='q']"/>
35 <feed xmlns="http://www.w3.org/2005/Atom">
36 <title>Example Solr Atom 1.0 Feed</title>
38 This has been formatted by the sample "example_atom.xsl" transform -
39 use your own XSLT to get a nicer Atom feed.
42 <name>Apache Solr</name>
43 <email>solr-user@lucene.apache.org</email>
45 <link rel="self" type="application/atom+xml"
46 href="http://localhost:8983/solr/q={$query}&wt=xslt&tr=atom.xsl"/>
48 <xsl:value-of select="response/result/doc[position()=1]/date[@name='timestamp']"/>
50 <id>tag:localhost,2007:example</id>
51 <xsl:apply-templates select="response/result/doc"/>
55 <!-- search results xslt -->
56 <xsl:template match="doc">
57 <xsl:variable name="id" select="str[@name='id']"/>
59 <title><xsl:value-of select="str[@name='name']"/></title>
60 <link href="http://localhost:8983/solr/select?q={$id}"/>
61 <id>tag:localhost,2007:<xsl:value-of select="$id"/></id>
62 <summary><xsl:value-of select="arr[@name='features']"/></summary>
63 <updated><xsl:value-of select="date[@name='timestamp']"/></updated>