[24446] | 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 RSS
|
---|
| 22 | -->
|
---|
| 23 |
|
---|
| 24 | <xsl:stylesheet version='1.0'
|
---|
| 25 | xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
|
---|
| 26 |
|
---|
| 27 | <xsl:output
|
---|
| 28 | method="xml"
|
---|
| 29 | encoding="utf-8"
|
---|
| 30 | media-type="application/xml"
|
---|
| 31 | />
|
---|
| 32 | <xsl:template match='/'>
|
---|
| 33 | <rss version="2.0">
|
---|
| 34 | <channel>
|
---|
| 35 | <title>Example Solr RSS 2.0 Feed</title>
|
---|
| 36 | <link>http://localhost:8983/solr</link>
|
---|
| 37 | <description>
|
---|
| 38 | This has been formatted by the sample "example_rss.xsl" transform -
|
---|
| 39 | use your own XSLT to get a nicer RSS feed.
|
---|
| 40 | </description>
|
---|
| 41 | <language>en-us</language>
|
---|
| 42 | <docs>http://localhost:8983/solr</docs>
|
---|
| 43 | <xsl:apply-templates select="response/result/doc"/>
|
---|
| 44 | </channel>
|
---|
| 45 | </rss>
|
---|
| 46 | </xsl:template>
|
---|
| 47 |
|
---|
| 48 | <!-- search results xslt -->
|
---|
| 49 | <xsl:template match="doc">
|
---|
| 50 | <xsl:variable name="id" select="str[@name='id']"/>
|
---|
| 51 | <xsl:variable name="timestamp" select="date[@name='timestamp']"/>
|
---|
| 52 | <item>
|
---|
| 53 | <title><xsl:value-of select="str[@name='name']"/></title>
|
---|
| 54 | <link>
|
---|
| 55 | http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
|
---|
| 56 | </link>
|
---|
| 57 | <description>
|
---|
| 58 | <xsl:value-of select="arr[@name='features']"/>
|
---|
| 59 | </description>
|
---|
| 60 | <pubDate><xsl:value-of select="$timestamp"/></pubDate>
|
---|
| 61 | <guid>
|
---|
| 62 | http://localhost:8983/solr/select?q=id:<xsl:value-of select="$id"/>
|
---|
| 63 | </guid>
|
---|
| 64 | </item>
|
---|
| 65 | </xsl:template>
|
---|
| 66 | </xsl:stylesheet>
|
---|