Author: rgardler
Date: Tue Jul 31 15:40:18 2007
New Revision: 561580

URL: http://svn.apache.org/viewvc?view=rev&rev=561580
Log:
Use names for categories in JSON output where available

Modified:
    
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-JSON.xsl

Modified: 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-JSON.xsl
URL: 
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-JSON.xsl?view=diff&rev=561580&r1=561579&r2=561580
==============================================================================
--- 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-JSON.xsl
 (original)
+++ 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-JSON.xsl
 Tue Jul 31 15:40:18 2007
@@ -20,7 +20,8 @@
   xmlns:atom="http://www.w3.org/2005/Atom";
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; 
   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"; 
-  xmlns:doap="http://usefulinc.com/ns/doap#";>
+  xmlns:doap="http://usefulinc.com/ns/doap#";
+  xmlns:dc="http://purl.org/dc/elements/1.1/";>
   <xsl:template match="/">{ "items": [<xsl:apply-templates 
select="descriptors"/>]} 
   </xsl:template>
   
@@ -52,7 +53,22 @@
   </xsl:template>
   
   <xsl:template match="doap:category">
-    "<xsl:apply-templates select="@rdf:resource"/>"<xsl:if 
test="not(position()=last())">, </xsl:if>
+    <xsl:variable name="category" select="@rdf:resource"/>
+    "<xsl:choose>
+          <xsl:when test="//descriptors/categories/categories/doap:[EMAIL 
PROTECTED]:resource = $category]/@dc:title">
+            <xsl:value-of 
select="//descriptors/categories/categories/doap:[EMAIL PROTECTED]:resource = 
$category]/@dc:title"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:choose>
+              <xsl:when test="@dc:title">
+                <xsl:value-of select="@dc:title"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="@rdf:resource"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:otherwise>
+        </xsl:choose>"<xsl:if test="not(position()=last())">, </xsl:if>
   </xsl:template>
   
   <xsl:template match="doap:*">