Author: rgardler
Date: Tue Sep 11 16:07:12 2007
New Revision: 574723
URL: http://svn.apache.org/viewvc?rev=574723&view=rev
Log:
Remove duplicates from seeAlso content. The first node to be found will always
be used. Duplicates are assumed to be elements with the same name and the same
content.
This means that we can have duplicates elements with different values
Added:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/resources/stylesheets/foaf-to-foafNoDuplicateNodes.xsl
(with props)
Modified:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/input.xmap
Modified:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/input.xmap
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/input.xmap?rev=574723&r1=574722&r2=574723&view=diff
==============================================================================
---
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/input.xmap
(original)
+++
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/input.xmap
Tue Sep 11 16:07:12 2007
@@ -64,11 +64,13 @@
<map:match pattern="personDetails.source.xml">
<map:generate type="file" src="{lm:foaf.descriptor}" />
<map:transform src="{lm:foaf.transform.foaf.foafExpandedSeeAlso}"/>
+ <map:transform src="{lm:foaf.transform.foaf.foafNoDuplicateNodes}"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="personDetails/*.source.xml">
<map:generate type="file" src="{lm:foaf.descriptor.{1}}" />
<map:transform src="{lm:foaf.transform.foaf.foafExpandedSeeAlso}"/>
+ <map:transform src="{lm:foaf.transform.foaf.foafNoDuplicateNodes}"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="personDetails.xml">
Added:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/resources/stylesheets/foaf-to-foafNoDuplicateNodes.xsl
URL:
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/resources/stylesheets/foaf-to-foafNoDuplicateNodes.xsl?rev=574723&view=auto
==============================================================================
---
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/resources/stylesheets/foaf-to-foafNoDuplicateNodes.xsl
(added)
+++
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/resources/stylesheets/foaf-to-foafNoDuplicateNodes.xsl
Tue Sep 11 16:07:12 2007
@@ -0,0 +1,48 @@
+<?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:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ exclude-result-prefixes="rdf dc foaf">
+
+ <xsl:template match="/">
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="rdf:seeAlso">
+ <xsl:variable name="seeAlsoFile"><xsl:value-of
select="@rdf:resource"/></xsl:variable>
+ <xsl:apply-templates
select="document($seeAlsoFile)/rdf:RDF/foaf:Person/*"/>
+ </xsl:template>
+
+ <xsl:template match="text()|processing-instruction()|comment()">
+ <xsl:copy>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="@*|node()">
+ <xsl:if test="not(node()) or
not(preceding-sibling::node()[.=string(current()) and name()=name(current())])">
+ <xsl:copy>
+ <xsl:apply-templates/>
+ </xsl:copy>
+ </xsl:if>
+ </xsl:template>
+</xsl:stylesheet>
\ No newline at end of file
Propchange:
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/resources/stylesheets/foaf-to-foafNoDuplicateNodes.xsl
------------------------------------------------------------------------------
svn:eol-style = native