cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject Re: [C2]: Browser Selector Bug
Date Mon, 30 Oct 2000 23:05:56 GMT
Giacomo,
The problem is with the sitemap.xsl. See attached patch to sitemap.xsl which fixes the NPE.
But
original problem is not yet solved because the generated _sitemap_xmap.java has empty selector_*
strings as shown below.

  static String [] selector_explorer_expr = {};
  static String [] selector_mozilla5_expr = {};

To Test the patch, just edit your sitemap.xmap as shown below. Without the attached patch
you will
get a NPE. With the patch you get the empty strings as shown above.

  <!-- ================  Hello  =========================== -->

   <map:match pattern="hello.html">
    <map:generate src="docs/samples/hello-page.xml"/>
	<map:select type="browser">
		<map:when test="explorer"> 
			<map:transform src="stylesheets/ie-html.xsl"/>
		</map:when> 
		<map:when test="mozilla5"> 
			<map:transform src="stylesheets/ns-html.xsl"/>
		</map:when> 
		<map:otherwise>
			<map:transform src="stylesheets/unknown-html.xsl"/>
		</map:otherwise>
	</map:select>
    <map:transform src="stylesheets/page/simple-page2html.xsl"/>
    <map:serialize type="html"/>
   </map:match>
 

Thanks,
dims

--- Giacomo Pati <Giacomo.Pati@pwr.ch> wrote:
> On Mon, Oct 30, 2000 at 03:16:26PM +0100, Carsten Ziegeler wrote:
> > Looking into the recent cvs source of C2, I saw that the BrowserSelectorFactory
does not use
> it's configuration any more and is therefore very useless. Is this intended or has it
only
> disappeared due to the Avalon/Xalan2 port? (If the second is true, should I reintegrate
it?)
> > 
> > But what is even worse, I can't use any selector. If I write
> > ....
> > 	<map:select type="browser">
> > 		<map:when test="mozilla"> 
> > 			<map:transform src="mozilla.xsl"/>
> > 		</map:when> 
> > 		<map:otherwise>
> > 			<map:transform src="other.xsl"/>
> > 		</map:otherwise>
> > 	</map:select>
> > .....
> > I get the following exception:
> > 
> > java.lang.NullPointerException
> > 	at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:917)
> > 	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:371)
> > 	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:371)
> > 	at
>
org.apache.cocoon.components.language.markup.LogicsheetCodeGenerator.generateCode(LogicsheetCodeGenerator.java:118)
> > 	at
>
org.apache.cocoon.components.language.markup.AbstractMarkupLanguage.generateCode(AbstractMarkupLanguage.java:296)
> > 	at
>
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(ProgramGeneratorImpl.java:193)
> > 	at org.apache.cocoon.sitemap.Handler.run(Handler.java:152)
> > 	at java.lang.Thread.run(Thread.java:484)
> 
> This is the point where I'm now without an idea what to do next. 
> You won't get that error when you test your sitemap with the 
> sitemap.xsl on the command line (using org.apache.xalan.xslt.Process). 
> Is there anybody more familiar with Xerces/Xalan who can help here?
>  
> Giacomo
> 
> -- 
> PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1  856 2202
> Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1  856 2201
> Hintereichenstrasse 7                     Mobil: +41 (0)78 759 7703
> CH-8166 Niederweningen                    Mailto:Giacomo.Pati@pwr.ch
>                                           Web:   http://www.pwr.ch


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/
Mime
View raw message