Stefano,

The two xsl files I changed were in xml-cocoon2/build/documentation/stylesheets.
They were: book2menu.xsl and site2xhtml.xsl. 

I changed the namespace declaration for the NetUtils external java function as follows:


   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                
xmlns:NetUtils="http://xml.apache.org/xslt/java/org.apache.cocoon.util.NetUtils";
                version="1.0">

and cast the argument to the encodePath method of the NetUtils class to a String as 
follows

   <xsl:variable name="encLabel" select="NetUtils:encodePath(string(@label))"/>


Stefano Mazzocchi wrote:
> 
> [EMAIL PROTECTED] wrote:
> >
> > > Hmmm, the source code says
> > >
> > >    if( null != sourceLocator )
> > >    {
> > >      n.addExtraDescription("location", sourceLocator.getSystemId());
> > >      ...
> > >    }
> > >
> > > so the NPE doesn't come from sourceLocator being null. Also, if
> > > getSystemId() returns null, the method is
> > >
> >
> > It depends on which version of Cocooon they are using. The test 'null !=
> > sourceLocator' is not yet present in 2.02, it was only added on May 7.
> 
> Oh, that explains it, thanks :)
> 
> hmmm, ok, I'll try XSLTC now and see what I can do.
> 
> Tom, can you send me the patches to the various xslt files that you did
> to have XSLTC compile the cocoon stylesheets? thanks.
> 
> --
> Stefano Mazzocchi      One must still have chaos in oneself to be
>                           able to give birth to a dancing star.
> <[EMAIL PROTECTED]>                             Friedrich Nietzsche
> --------------------------------------------------------------------

-- 
 Tom Amiro -- SQA Engineer
 Sun XML Technology Development
 voice: 781-442-0589 Fax: 781-442-1437
 eMail: [email protected]
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                
xmlns:NetUtils="http://xml.apache.org/xslt/java/org.apache.cocoon.util.NetUtils";
                version="1.0">

  <xsl:param name="resource"/>

  <xsl:template match="book">
    <menu>
      <xsl:apply-templates/>
    </menu>
  </xsl:template>

  <xsl:template match="project">
  </xsl:template>

  <xsl:template match="menu[position()=1]">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="menu">
     <!-- Encode label to escape any reserved characters such as space -->
     <xsl:variable name="encLabel" select="NetUtils:encodePath(string(@label))"/>
     <tr>
      <td valign="top" bgcolor="#959595" background="images/label-background_b.gif">
       <img src="images/separator.gif"/><br/>
       <span class="menutitle"><xsl:value-of select="@label"/></span></td>
     </tr>
     <xsl:apply-templates/>
  </xsl:template>


  <xsl:template match="menu-item">
    <xsl:if test="not(@type) or @type!='hidden'">
     <xsl:variable name="encLabel" select="NetUtils:encodePath(string(@label))"/>
     <tr>
      <td bgcolor="#959595" valign="top">
       <xsl:attribute name="background">images/label-background_a.gif</xsl:attribute>
       <xsl:choose>
         <xsl:when test="contains(@href, $resource)">
           <span class="menuselected"><xsl:value-of select="@label"/></span>
         </xsl:when>
         <xsl:otherwise>
           <a href="{@href}" class="menu"><xsl:value-of select="@label"/></a>
         </xsl:otherwise>
       </xsl:choose>
      </td>
     </tr>
    </xsl:if>
  </xsl:template>

  <xsl:template match="external">
    <xsl:if test="not(@type) or @type!='hidden'">
     <xsl:variable name="encLabel" select="NetUtils:encodePath(string(@label))"/>
     <tr><td bgcolor="#959595" background="images/label-background_a.gif" valign="top">
        <a href="{@href}" target="new" class="menu"><xsl:value-of select="@label"/></a>
        </td>
     </tr>
    </xsl:if>
  </xsl:template>

  <xsl:template match="node()|@*" priority="-1"/>
</xsl:stylesheet>

http://xml.apache.org/ http://www.apache.org/ http://www.w3.org/


Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.

Reply via email to