I would prefer to send out a tarball, but all I have access to right
now is zip so I've been forced to include several files, a
readme, and the patch file of course. I believe this is all you need,
but make sure to check out the readme before trying anything new.

Robert

Attachment: patch.patch
Description: Binary data

RefDoc Patch Documentation

*************** Changes: ************************************************

/refdoc/samples/sitemap.xmap:
    Added match for "index.html" because "/" wasn't matching for me.

/refdoc/samples/index.html
    Added a couple links, one is to view a search for "firstExample" on the
    (indexed) snippets
    Also added a link to view the neutral document generated that is nearly 
ready
    for publishing. Needs more testing.
    
/refdoc/samples/snippets/sitemap.xmap
    Modified for the above links and some testing of indexing techniques, also
    uses the below XSLT files.

/refdoc/samples/snippets/snippets-to-index.xsl
    Modified to include more information for indexing

/refdoc/samples/snippets/to-snippets.xsl
    Created to reaplce (a refactor albeit a bad one) of xml-to-snippets.xsl
    and slop-to-snippets.xsl

/refdoc/samples/snippets/searchxml-to-neutraldoc.xsl
    My own creation for going from search result XML from a query
    to a neutral publishable document that has all snippets for the
    queried key and *may* be sorted by type. Not enough testing.
    
/refdoc/samples/annotated-code/xmlfile.xml
    Modified to include commas between key value pairs
    
/refdoc/samples/annotated-code/subdir/dummy-sitemap.xweb
    Modified to include commas between key value pairs
    
/refdoc/samples/annotated-code/org/apache/cocoon/doktorexamples/AnnotatedClass.java
    Modified to include commas between key value pairs
    
/refdoc/java/org/apache/cocoon/doktor/DoktorMetadataTransformer.java
    Modified to parse out comma separated key value pairs
    
*********** Changes to cocoon-lucene.xconf in /WEB-INF/xconf/  
*********************

Original:
  <cocoon-crawler logger="core.search.crawler"/>
  <lucene-xml-indexer logger="core.search.lucene"/>

Needed for indexing/searching:
  <cocoon-crawler logger="core.search.crawler" >
      <include>.*/refdoc/snippets/samples/</include>
  </cocoon-crawler>
  <lucene-xml-indexer logger="core.search.lucene">
      <index-fields>snippet_id, metadata, comment</index-fields>
      <store-fields>snippet_id, metadata, comment, filename, key, 
type</store-fields>
  </lucene-xml-indexer>
  
********************  To index with lucene block 
********************************

Head to:  <context>/samples/blocks/lucene/create

Create an index (with the above configuration) on
    <context>/samples/blocks/refdoc/snippets/samples/
    
**************************************************************************

I think thats it, if something goes wrong contact me if you need to. It's all 
pretty simple.
<?xml version="1.0"?>
<!--
  Copyright 1999-2004 The Apache Software Foundation

  Licensed 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.
-->

<!--
  Take the search results and create a document in a neutral XML format
  ready for publishing

  SVN $Id: searchxml-to-neutralDoc.xsl,v 1.1 2005/06/02 16:28:35 bdelacretaz Exp $
 -->
<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:search="http://apache.org/cocoon/search/1.0";
>

  <xsl:template match="//search:results">
    <xsl:element name="[EMAIL PROTECTED]">
        <xsl:apply-templates select="//search:hits/search:hit">
            <xsl:sort order="descending" select="descendant::search:hits/search:hit/search:field[type = @name]/."/> 
        </xsl:apply-templates>
    </xsl:element> 
  </xsl:template>
  

  <xsl:template match="search:hit">
    <snippet>
        <uri><xsl:value-of select="@uri"/></uri>
        <xsl:apply-templates select="descendant::search:field"/>
    </snippet>
  </xsl:template>
  
  <xsl:template match="search:field">
    <xsl:element name="[EMAIL PROTECTED]">
        <xsl:value-of select ="."/>
    </xsl:element>
  </xsl:template>

</xsl:transform>
<?xml version="1.0"?>
<!--
  Copyright 1999-2004 The Apache Software Foundation

  Licensed 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.
-->

<!--
  Convert the output of mark-xml-comments.xsl to doktor snippets
  and covert the output of mark-slop-lines.xsl to doktor snippets
 -->
 
<xsl:transform version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:slop="http://apache.org/cocoon/slop/parser/1.0";
  xmlns:doktor="http://apache.org/cocoon/doktor/1.0";
  exclude-result-prefixes=""
>

  <xsl:param name="filename"/>
  <xsl:param name="extension"/>
  <xsl:param name="mode"/>
  
    <xsl:template match="/">
    <doktor:snippets filename="{$filename}" extension="{$extension}" input-mode="$mode">
      <!-- process doktor and start comments only for text, all for xml -->
      <xsl:choose>
          <xsl:when test="contains($mode, 'text')">
          <xsl:apply-templates select="//[EMAIL PROTECTED]:doktor or @doktor:doktor-start]"/>
          </xsl:when>          
          <xsl:when test="contains($mode, 'xml')">
                    <xsl:apply-templates select="//doktor:[EMAIL PROTECTED]:doktor or @doktor:doktor-start or @doktor:doktor-element]"/>
          </xsl:when>    
      </xsl:choose>
    </doktor:snippets>
  </xsl:template>

  <!-- XML MODE -->
  <!-- doktor comments: generate a snippet -->
  <xsl:template match="doktor:[EMAIL PROTECTED]:doktor]">
    <doktor:snippet mode="line">
      <xsl:call-template name="snippetId-xml"/>
      <doktor:content>
        <xsl:apply-templates select="." mode="copy-xml"/>
      </doktor:content>
    </doktor:snippet>
  </xsl:template>

  <!-- element comments: generate a snippet containing following XML element -->
  <xsl:template match="doktor:[EMAIL PROTECTED]:doktor-element]">
    <doktor:snippet mode="xml">
      <xsl:call-template name="snippetId-xml"/>
      <doktor:content>
        <xsl:apply-templates select="." mode="copy-xml"/>
        <xsl:apply-templates select="following::*[1]" mode="copy-xml"/>
      </doktor:content>
    </doktor:snippet>
  </xsl:template>

  <!-- start comments: generate a snippet with all nodes between this and the end comment -->
  <xsl:template match="doktor:[EMAIL PROTECTED]:doktor-start]">
    <xsl:variable name="endLine" select="following::doktor:[EMAIL PROTECTED]:doktor-end][1]/@doktor:counter"/>
    <doktor:snippet mode="xml">
      <xsl:call-template name="snippetId-xml"/>
      <doktor:content>
        <xsl:apply-templates
          select="self::*|following-sibling::node()[EMAIL PROTECTED]:counter &lt; $endLine]"
          mode="copy"
        />
      </doktor:content>
    </doktor:snippet>
  </xsl:template>
  
  
   <!-- convert doktor:comments back -->
  <xsl:template match="doktor:comment" mode="copy-xml">
    <xsl:comment>
      <xsl:value-of select="."/>
    </xsl:comment>
  </xsl:template>

  <!-- but keep doktor:comments that must be parsed -->
  <xsl:template match="doktor:[EMAIL PROTECTED]:doktor-toparse]" mode="copy-xml">
    <xsl:copy-of select="."/>
  </xsl:template>

  <!-- copy elements -->
  <xsl:template match="*" mode="copy-xml">
    <xsl:copy>
      <xsl:copy-of select="@*"/>
      <xsl:apply-templates mode="copy"/>
    </xsl:copy>
  </xsl:template>
  
    <!-- generate snippet id -->
  <xsl:template name="snippetId-xml">
    <xsl:attribute name="id">
      <xsl:value-of select="concat('snippet_',@doktor:counter)"/>
    </xsl:attribute>
  </xsl:template>
  
  <!-- END XML MODE -->
    
  <!-- TEXT MODE-->
  
    <!-- doktor lines: generate a snippet -->
  <xsl:template match="slop:[EMAIL PROTECTED]:doktor]">
    <doktor:snippet line-number="[EMAIL PROTECTED]" mode="line">
      <xsl:copy-of select="@*"/>
      <xsl:call-template name="snippetId-text"/>
      <doktor:content>
        <xsl:value-of select="."/>
      </doktor:content>
    </doktor:snippet>
  </xsl:template>

  <!-- start lines: generate a snippet with all elements between this and end line -->
  <xsl:template match="slop:[EMAIL PROTECTED]:doktor-start]">
    <xsl:variable name="endLine" select="following::slop:[EMAIL PROTECTED]:doktor-end][1]/@line-number"/>
    <doktor:snippet mode="text">
      <xsl:call-template name="snippetId-text"/>
      <doktor:content>
          <xsl:apply-templates
            select="self::*|following::slop:[EMAIL PROTECTED] &lt; $endLine]"
            mode="copy-text"
          />
      </doktor:content>
    </doktor:snippet>
  </xsl:template>

  <!-- copy slop elements, removing namespace -->
  <xsl:template match="slop:*" mode="copy-text">
    <line>
      <xsl:copy-of select="@*"/>
      <xsl:value-of select="."/>
    </line>
  </xsl:template>
  
    <!-- generate snippet id -->
  <xsl:template name="snippetId-text">
    <xsl:attribute name="id">
      <xsl:value-of select="concat('snippet_',@line-number)"/>
    </xsl:attribute>
  </xsl:template>
  
  <!-- END TEXT MODE-->
  
</xsl:transform>

Reply via email to