forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r178772 - in /forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy: input.xmap resources/stylesheets/repoRequest2doc.xsl src/documentation/content/xdocs/index.xml
Date Fri, 27 May 2005 12:13:15 GMT
Author: rgardler
Date: Fri May 27 05:13:13 2005
New Revision: 178772

URL: http://svn.apache.org/viewcvs?rev=178772&view=rev
Log:
Provide pre and post filters and allow the tretrieval of unprocessed content. Add warning
that the source format will later change to the daisy XML document rather than the HTML document
it currently is.

Modified:
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/input.xmap
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/resources/stylesheets/repoRequest2doc.xsl
    forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/src/documentation/content/xdocs/index.xml

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/input.xmap
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/input.xmap?rev=178772&r1=178771&r2=178772&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/input.xmap (original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/input.xmap Fri
May 27 05:13:13 2005
@@ -37,18 +37,32 @@
 		<!-- ============================================================== -->
 		<map:pipeline>
 			<map:match
+				pattern="do/getRepositoryData/daisy/*/port/*/collection/*/doc/**.source.xml">
+				<map:generate type="html" src="http://{1}:{2}/{3}/{4}?navigationType=none" />
+				<map:serialize type="xml" />
+			</map:match>
+      
+			<map:match
 				pattern="do/getRepositoryData/daisy/*/port/*/collection/*/doc/**.xml">
 				<map:generate type="html" src="http://{1}:{2}/{3}/{4}?navigationType=none" />
-        <map:transform src="{project:resources.stylesheets}/daisyFilter.xsl"/>
+        <map:transform src="{project:resources.stylesheets}/daisy/preFilter.xsl"/>
 				<map:transform src="{forrest:stylesheets}/html2document.xsl" />
+        <map:transform src="{project:resources.stylesheets}/daisy/postFilter.xsl"/>
+				<map:serialize type="xml" />
+			</map:match>
+      
+			<map:match
+				pattern="do/getRepositoryData/daisy/**/collection/*/doc/**.source.xml">
+				<map:generate type="html" src="http://{1}/{2}/{3}?navigationType=none" />
 				<map:serialize type="xml" />
 			</map:match>
       
 			<map:match
 				pattern="do/getRepositoryData/daisy/**/collection/*/doc/**.xml">
 				<map:generate type="html" src="http://{1}/{2}/{3}?navigationType=none" />
+				<map:transform src="{project:resources.stylesheets}/daisy/preFilter.xsl"/>
         <map:transform src="{forrest:stylesheets}/html2document.xsl" />
-				<map:transform src="{project:resources.stylesheets}/daisyFilter.xsl"/>
+        <map:transform src="{project:resources.stylesheets}/daisy/postFilter.xsl"/>
 				<map:serialize type="xml" />
 			</map:match>
 		</map:pipeline>
@@ -59,7 +73,9 @@
           <map:parameter name="parameter-name" value="repositoryType"/>
           <map:when test="daisy-wiki">
             <map:generate type="request"/>
-            <map:transform src="resources/stylesheets/repoRequest2doc.xsl"/>
+            <map:transform src="resources/stylesheets/repoRequest2doc.xsl">
+              <map:parameter name="localURL" value="{1}.xml"/>
+            </map:transform>
             <map:serialize type="xml" />
           </map:when>
         </map:select>
@@ -72,7 +88,9 @@
           <map:parameter name="parameter-name" value="repositoryType"/>
           <map:when test="daisy-wiki">
             <map:generate type="request"/>
-            <map:transform src="resources/stylesheets/repoRequest2doc.xsl"/>
+            <map:transform src="resources/stylesheets/repoRequest2doc.xsl">
+              <map:parameter name="localURL" value="{1}/{2}.xml"/>
+            </map:transform>
             <map:serialize type="xml" />
           </map:when>
         </map:select>

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=178772&r1=178771&r2=178772&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 May 27 05:13:13 2005
@@ -19,23 +19,39 @@
 				xmlns:req="http://apache.org/cocoon/request/2.0"
 				version="1.0">
 
+  <xsl:param name="localURL"/>
   <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="repositoryCollection"><xsl:value-of select="req:request/req:requestParameters/req:parameter[@name='repositoryCollection']/req:value"/></xsl:param>
 	
-  <xsl:template match="req:request">      
+  <xsl:template match="req:request">   
 			<xsl:choose>
 				<xsl:when test="$repositoryPort">
-					<xsl:variable name="document">cocoon:/do/getRepositoryData/daisy/<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:call-template name="processDocument">
+					  <xsl:with-param name="remoteURL">cocoon:/do/getRepositoryData/daisy/<xsl:value-of
select="$repositoryURL"/>/port/<xsl:value-of select="$repositoryPort"/>/collection/<xsl:value-of
select="$repositoryCollection"/>/doc/<xsl:value-of select="$documentID"/></xsl:with-param>
+          </xsl:call-template>
 				</xsl:when>
 				<xsl:otherwise>
-					<xsl:variable name="document">cocoon:/do/getRepositoryData/daisy/<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:call-template name="processDocument">
+					  <xsl:with-param name="remoteURL">cocoon:/do/getRepositoryData/daisy/<xsl:value-of
select="$repositoryURL"/>/collection/<xsl:value-of select="$repositoryCollection"/>/doc/<xsl:value-of
select="$documentID"/></xsl:with-param>
+          </xsl:call-template>
 				</xsl:otherwise>
 		</xsl:choose>
-
+  </xsl:template>
+  
+  <xsl:template name="processDocument">
+    <xsl:param name="remoteURL"/>
+    <xsl:choose>
+      <xsl:when test="contains($localURL, '.source.xml')">
+        <xsl:variable name="document"><xsl:value-of select="$remoteURL"/>.source.xml</xsl:variable>
+        <xsl:apply-templates select="document($document)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="document"><xsl:value-of select="$remoteURL"/>.xml</xsl:variable>
+        <xsl:apply-templates select="document($document)"/>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:template>  
     
   <xsl:template match="link">

Modified: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/src/documentation/content/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/src/documentation/content/xdocs/index.xml?rev=178772&r1=178771&r2=178772&view=diff
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/src/documentation/content/xdocs/index.xml
(original)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.input.Daisy/src/documentation/content/xdocs/index.xml
Fri May 27 05:13:13 2005
@@ -89,31 +89,53 @@
       </table>
       
       <section>
+        <title>Retrieving RAW content</title>
+        <p>If you want to retrieve the raw, unprocessed HTML from
+        Daisy simply request the file with a <code>.source.xml</code>
+        extenstion.</p>
+        
+        <warning>This behaviour will change in the future to enable
+        you to retrieve the raw unprocessed XML rather than the
+        HTML from Daisy. Use with care in the meantime.</warning>
+      </section>
+      
+      <section>
         <title>Filtering Content</title>
         <p>You may not have full control of the content in the repository, or
         you may wish to supress the presentation of some of the parts, for 
-        example, the fields within the repository. To achieve this you can 
-        provide an XSL file called <code>daisyFilter.xsl</code> in your 
-        projects stylesheets directory (default location is 
-        <code>PROJECT_HOME/src/documentation/resources/stylesheets</code>).
-        Using this file you can filter out any part of the content you 
-        desire.</p>
-        
-        <p>The XSL file operates on the XDoc generated by Forrest, not 
-        on the source format of the document. If you wish to look at the 
-        XDoc format of the document simply request the page with an
-        <code>xml</code> extension.</p>
+        example, the fields within the repository. There are two points at 
+        which you can filter the content, at the point of retrieval (called a
+        pre-filter) and once the file has been converted to the internal 
+        Forrest format (called a post-filter).</p>
         
         <section>
-          <title>Example</title>
-          <p>To filter out the <code>Fields</code> section of the Daisy
-          document, use the following XSL:</p>
+          <title>Pre-Filters</title>
+          
+          <p>Pre-Filters are applied to the HTML retrieved from the 
+          Daisy repository. To achieve this you can 
+          provide an XSL file called <code>daisy/preFilter.xsl</code> in your

+          projects stylesheet directory (default location is 
+          <code>PROJECT_HOME/src/documentation/resources/stylesheets</code>).</p>
+        
+          <p>The preFilter XSL file operates on the HTML generated by Daisy. 
+          If you wish to look at this format of the document simply request 
+          the page with an <code>.source.xml</code> extension.</p>
+        
+          <warning>This behaviour will change in the future,
+          instead of processing the HTML produced by Daisy we will process 
+          the the XML. Use with care in the meantime.</warning>
           
-          <source><![CDATA[
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+          <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
 				version="1.0">
   
-  <xsl:template match="section[title='Fields']"/>
+          
+          <section>
+            <title>Example</title>
+            <p>To filter out the document heading of the Daisy
+            document, use the following XSL:</p>
+            
+            <source><![CDATA[
+  <xsl:template match="h1[@class='daisy-document-name']"/>
   
   <xsl:template match="@*|*|text()|processing-instruction()|comment()">
     <xsl:copy>
@@ -121,13 +143,47 @@
     </xsl:copy>
   </xsl:template>
 </xsl:stylesheet>
-          ]]></source>
-          
-          <p>This XSL will filter out all fields from all files retreived 
-          from a Daisy repository. If you only wanted to remove them from
-          specific files, or only remove specific fields you would need
-          to extend this stylesheet accordingly.</p>
+            ]]></source>
+          </section>
         </section>
+        
+        <section>
+          <title>Post-Filters</title>
+          
+          <p>Post-Filters are applied to the XDoc generated by 
+          Forrest. To achieve this you can 
+          provide an XSL file called <code>daisy/postFilter.xsl</code> in your

+          projects stylesheet directory (default location is 
+          <code>PROJECT_HOME/src/documentation/resources/stylesheets</code>).</p>
+        
+          <p>The postFilter XSL file operates on the XDoc generated by Forrest. 
+          If you wish to look at this format of the document simply request 
+          the page with an <code>.xml</code> extension.</p>
+        
+          <section>
+            <title>Example</title>
+            <p>To filter out the <code>Fields</code> section of the Daisy
+            document, use the following XSL:</p>
+            
+            <source><![CDATA[
+  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
+          version="1.0">
+    
+    <xsl:template match="section[title='Fields']"/>
+    
+    <xsl:template match="@*|*|text()|processing-instruction()|comment()">
+      <xsl:copy>
+        <xsl:apply-templates select="@*|*|text()|processing-instruction()|comment()"/>
+      </xsl:copy>
+    </xsl:template>
+  </xsl:stylesheet>
+            ]]></source>
+            
+            <p>This XSL will filter out all fields from all files retreived 
+            from a Daisy repository. If you only wanted to remove them from
+            specific files, or only remove specific fields you would need
+            to extend this stylesheet accordingly.</p>
+          </section>
       </section>
       
       <section>



Mime
View raw message