forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r164302 - /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/resources/stylesheets/repoRequest2doc.xsl
Date Fri, 22 Apr 2005 23:48:47 GMT
Author: rgardler
Date: Fri Apr 22 16:48:47 2005
New Revision: 164302

URL: http://svn.apache.org/viewcvs?rev=164302&view=rev
Log:
rewrite href links so that they retrieve documents from the repository where appropriate.

Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/resources/stylesheets/repoRequest2doc.xsl

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/resources/stylesheets/repoRequest2doc.xsl
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/resources/stylesheets/repoRequest2doc.xsl?rev=164302&r1=164301&r2=164302&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/resources/stylesheets/repoRequest2doc.xsl
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/resources/stylesheets/repoRequest2doc.xsl
Fri Apr 22 16:48:47 2005
@@ -19,29 +19,43 @@
 				xmlns:req="http://apache.org/cocoon/request/2.0"
 				version="1.0">
 
-  	  <xsl:param name="documentID"/>
-
-      <xsl:template match="req:request">
-			<xsl:variable name="repositoryURL"><xsl:value-of select="req:requestParameters/req:parameter[@name='repositoryURL']/req:value"/></xsl:variable>
-			<xsl:variable name="repositoryPort"><xsl:value-of select="req:requestParameters/req:parameter[@name='repositoryPort']/req:value"/></xsl:variable>
-			<xsl:variable name="repositoryType"><xsl:value-of select="req:requestParameters/req:parameter[@name='repositoryType']/req:value"/></xsl:variable>
-
+  <xsl:param name="documentID"><xsl:value-of select="req:request/req:requestParameters/req:parameter[@name='documentID']/req:value"/></xsl:param>
+  <xsl:param name="repositoryURL"><xsl:value-of select="req:request/req:requestParameters/req:parameter[@name='repositoryURL']/req:value"/></xsl:param>
+	<xsl:param name="repositoryPort"><xsl:value-of select="req:request/req:requestParameters/req:parameter[@name='repositoryPort']/req:value"/></xsl:param>
+	<xsl:param name="repositoryType"><xsl:value-of select="req:request/req:requestParameters/req:parameter[@name='repositoryType']/req:value"/></xsl:param>
+  <xsl:param name="repositoryCollection"><xsl:value-of select="req:request/req:requestParameters/req:parameter[@name='repositoryCollection']/req:value"/></xsl:param>
+	
+  <xsl:template match="req:request">      
 			<xsl:choose>
 				<xsl:when test="$repositoryPort">
-					<xsl:variable name="document">cocoon:/do/getRepositoryData/<xsl:value-of select="$repositoryType"/>/<xsl:value-of
select="$repositoryURL"/>/port/<xsl:value-of select="$repositoryPort"/>/doc/<xsl:value-of
select="$documentID"/>.xml</xsl:variable>
-		            <xsl:apply-templates select="document($document)"/>
+					<xsl:variable name="document">cocoon:/do/getRepositoryData/<xsl:value-of select="$repositoryType"/>/<xsl:value-of
select="$repositoryURL"/>/port/<xsl:value-of select="$repositoryPort"/>/collection/<xsl:value-of
select="$repositoryCollection"/>/doc/<xsl:value-of select="$documentID"/>.xml</xsl:variable>
+		      <xsl:apply-templates select="document($document)"/>
 				</xsl:when>
 				<xsl:otherwise>
-					<xsl:variable name="document">cocoon:/do/getRepositoryData/<xsl:value-of select="$repositoryType"/>/<xsl:value-of
select="$repositoryURL"/>/doc/<xsl:value-of select="$documentID"/>.xml</xsl:variable>
-		            <xsl:apply-templates select="document($document)"/>
+					<xsl:variable name="document">cocoon:/do/getRepositoryData/<xsl:value-of select="$repositoryType"/>/<xsl:value-of
select="$repositoryURL"/>/collection/<xsl:value-of select="$repositoryCollection"/>/doc/<xsl:value-of
select="$documentID"/>.xml</xsl:variable>
+		      <xsl:apply-templates select="document($document)"/>
 				</xsl:otherwise>
-			</xsl:choose>
+		</xsl:choose>
 
-      </xsl:template>
+  </xsl:template>  
+    
+  <xsl:template match="link">
+    <a>
+      <xsl:attribute name="href">
+        <xsl:choose>
+          <xsl:when test="starts-with(@href, 'http://') or starts-with(@href, 'mailto:')">
+            <xsl:value-of select="@href"/>
+          </xsl:when>
+          <xsl:otherwise><xsl:value-of select="@href"/>?repositoryURL=<xsl:value-of
select="$repositoryURL"/>&amp;repositoryCollection=<xsl:value-of select="$repositoryCollection"/>&amp;repositoryPort=<xsl:value-of
select="$repositoryPort"/>&amp;repositoryType=<xsl:value-of select="$repositoryType"/>&amp;documentID=<xsl:value-of
select="@href"/></xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+      <xsl:apply-templates select="node()[not(@href)]"/>
+    </a>
+  </xsl:template>
 
-  <xsl:template match="@*|node()">
+  <xsl:template match="@*|*|text()|processing-instruction()|comment()">
     <xsl:copy>
-      <xsl:apply-templates select="@*|node()"/>
+      <xsl:apply-templates select="@*|*|text()|processing-instruction()|comment()"/>
     </xsl:copy>
   </xsl:template>
       



Mime
View raw message