forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r545481 - /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-contactsCSV.xsl
Date Fri, 08 Jun 2007 11:35:30 GMT
Author: rgardler
Date: Fri Jun  8 04:35:29 2007
New Revision: 545481

URL: http://svn.apache.org/viewvc?view=rev&rev=545481
Log:
- split names where possible
- strip mailto: from email address

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

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-contactsCSV.xsl
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-contactsCSV.xsl?view=diff&rev=545481&r1=545480&r2=545481
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-contactsCSV.xsl
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.doap/resources/stylesheets/descriptorIndex-to-contactsCSV.xsl
Fri Jun  8 04:35:29 2007
@@ -38,7 +38,7 @@
         <xsl:apply-templates />
     </xsl:template>
     <xsl:template match="doap:maintainer">
-      <xsl:if test="foaf:Person/foaf:mbox/@rdf:resource">
+      <xsl:if test="starts-with(foaf:Person/foaf:mbox/@rdf:resource, 'mailto:')">
         <xsl:value-of select="normalize-space(../doap:name)" />,<xsl:apply-templates
/>
 <xsl:text>
 
@@ -46,9 +46,30 @@
       </xsl:if>
     </xsl:template>
     <xsl:template match="foaf:Person">
-        <xsl:value-of select="normalize-space(foaf:name)" />,<xsl:value-of select="normalize-space(foaf:mbox/@rdf:resource)"
/>
+        <xsl:apply-templates select="foaf:name" />,<xsl:apply-templates select="foaf:mbox"
/>
+    </xsl:template>
+    
+    <xsl:template match="foaf:name">
+      <xsl:choose>
+          <xsl:when test="contains(., ' ')">
+            <xsl:value-of select="normalize-space(substring-before(., ' '))"/>,<xsl:value-of
select="normalize-space(substring-after(., ' '))"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:text>,</xsl:text><xsl:value-of select="normalize-space(.)"/>
+          </xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template match="foaf:mbox">
+      <xsl:if test="starts-with(@rdf:resource, 'mailto:')">
+        <xsl:value-of select="substring(@rdf:resource,8)"/>
+      </xsl:if>
     </xsl:template>
 
+    <xsl:template match="text()">
+      <xsl:value-of select="normalize-space(.)"/>
+    </xsl:template>
+    
     <xsl:template
-        match="@*|text()|*|processing-instruction()|comment()" />
+        match="@*|*|processing-instruction()|comment()" />
 </xsl:stylesheet>



Mime
View raw message