You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by ju...@apache.org on 2007/08/24 22:20:57 UTC

svn commit: r569509 - /labs/juuso/doap2juuso.xslt

Author: jukka
Date: Fri Aug 24 13:20:57 2007
New Revision: 569509

URL: http://svn.apache.org/viewvc?rev=569509&view=rev
Log:
juuso: Added a XSL transformation for converting (simple) DOAP in RDF/XML format to facts understood by Juuso

Added:
    labs/juuso/doap2juuso.xslt   (with props)

Added: labs/juuso/doap2juuso.xslt
URL: http://svn.apache.org/viewvc/labs/juuso/doap2juuso.xslt?rev=569509&view=auto
==============================================================================
--- labs/juuso/doap2juuso.xslt (added)
+++ labs/juuso/doap2juuso.xslt Fri Aug 24 13:20:57 2007
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ -->
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                xmlns="http://usefulinc.com/ns/doap#"
+                xmlns:foaf="http://xmlns.com/foaf/0.1/"
+                xmlns:labs="http://labs.apache.org/doap-ext/1.0#"
+                xmlns:projects="http://projects.apache.org/ns/asfext#">
+
+  <xsl:output method="text"/>
+
+  <xsl:template match="rdf:RDF">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="*[@rdf:about]">
+    doap("<xsl:value-of select="@rdf:about"/>",
+         rdf("type"),
+         "<xsl:value-of select="namespace-uri(.)"/><xsl:value-of select="local-name(.)"/>")
+    <xsl:apply-templates>
+      <xsl:with-param name="subject" select="@rdf:about"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="*[@rdf:resource]">
+    <xsl:param name="subject"/>
+    doap("<xsl:value-of select="$subject"/>",
+         "<xsl:value-of select="namespace-uri(.)"/><xsl:value-of select="local-name(.)"/>",
+         "<xsl:value-of select="@rdf:resource"/>")
+  </xsl:template>
+
+  <xsl:template match="*[*]" priority="-1">
+    <xsl:param name="subject"/>
+    doap("<xsl:value-of select="$subject"/>",
+         "<xsl:value-of select="namespace-uri(.)"/><xsl:value-of select="local-name(.)"/>",
+         "<xsl:value-of select="generate-id(.)"/>")
+    <xsl:apply-templates>
+      <xsl:with-param name="subject" select="generate-id(.)"/>
+    </xsl:apply-templates>
+  </xsl:template>
+
+  <xsl:template match="*" priority="-2">
+    <xsl:param name="subject"/>
+    doap("<xsl:value-of select="$subject"/>",
+         "<xsl:value-of select="namespace-uri(.)"/><xsl:value-of select="local-name(.)"/>",
+         "<xsl:value-of select="text()"/>")
+  </xsl:template>
+
+</xsl:stylesheet>
+

Propchange: labs/juuso/doap2juuso.xslt
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org