XSLT to convert Pazpar2's output for reading by Carrot2 clustering engine.
authorJason Skomorowski <jason@indexdata.com>
Thu, 6 May 2010 18:58:54 +0000 (14:58 -0400)
committerJason Skomorowski <jason@indexdata.com>
Thu, 6 May 2010 18:58:54 +0000 (14:58 -0400)
etc/pp2out-to-carrot2.xsl [new file with mode: 0644]

diff --git a/etc/pp2out-to-carrot2.xsl b/etc/pp2out-to-carrot2.xsl
new file mode 100644 (file)
index 0000000..a1d1677
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output indent="yes" method="xml" version="1.0" encoding="UTF-8"/>
+<xsl:template match="/">
+  <searchresult>
+    <!-- TODO make query an xsl parameter -->
+    <query>water</query>
+    <xsl:for-each select="show/hit">
+    <document>
+      <xsl:attribute name="id">
+        <xsl:value-of select="location/md-id" />
+      </xsl:attribute>
+      <title><xsl:value-of select="md-title" /></title>
+      <url><xsl:value-of select="recid" /></url>
+      <snippet xml:space="preserve">
+        <xsl:for-each select="md-description">
+          <xsl:value-of select="." />
+        </xsl:for-each>
+        <xsl:value-of select="md-title-responsibility" />
+      </snippet>
+    </document> 
+    </xsl:for-each>
+  </searchresult>
+</xsl:template>
+</xsl:stylesheet>
\ No newline at end of file