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]Xinclude transformer bug?
Date Wed, 01 Nov 2000 20:25:30 GMT
Lassi,

Can you please get the new sources and try your sample again? Checked in a fix to
XIncludeTransformer.java for this problem.

Thanks,
dims

--- Lassi Immonen <limmonen@urova.fi> wrote:
> Hi,
> 
> I'm investigating ways to use xinclude in stylesheet to get common
> elements in html page through stylesheet.
> 
> This is my setup.
> ----------------------------
> Sitemap:
> <map:match pattern="includetest_xsl">
> 	<map:generate src="digma/include_test.xml"/>
> 	<map:transform src="digma/include2page.xsl"/> 
> 	<map:transform type="xinclude"/>
> 	<!-- <map:transform src="digma/simple2html.xsl"/> -->
> 	<map:serialize type="html"/>
> </map:match>
> ---------------------------
> include_test.xml:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <inc_test>
> 	<inc_title>Title from include_test</inc_title>
> 	<inc_para>Para1 from include_test</inc_para>
> 	<inc_para>Para2 from include_test</inc_para>
> </inc_test>
> ---------------------------
> include2page.xsl:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0" 
> 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> 	>
> <xsl:template match="/">
> 	<content 
> 	xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
> 	xmlns:base="http://www.w3.org/XML/1998/namespace">
> 	
> 	<xinclude:include href="include_me.xml" parse="xml"
> 	base:base="file:/f:/tomcat4.0m3/webapps/cocoon/digma/"/>
> 	<para>This part is from include2page.xsl</para>
>   		<xsl:apply-templates/>  
>      	</content>	
>  </xsl:template>
> 
> <xsl:template match="*|@*|text()">
>    <xsl:copy>
>     <xsl:apply-templates select="*|@*|text()"/>
>    </xsl:copy> 
>   </xsl:template>
> 
> </xsl:stylesheet>
> -------------------------
> include_me.xml:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <inc_page>
> 	<inc_title>This is coming from inside include_me.xml</inc_title>
> </inc_page>
> -------------------------
> 
> Without xinclude transformation in sitemap output is:
> 
> <content xmlns:base="http://www.w3.org/XML/1998/namespace"
> xmlns:xinclude="http://www.w3.org/1999/XML/xinclude">
> <xinclude:include base:base="file:/f:/tomcat4.0m3/webapps/cocoon/digma/"
> parse="xml" href="include_me.xml"></xinclude:include>
> <para>This part is from include2page.xsl</para>
> <inc_test>
>         <inc_title>Title from include_test</inc_title>
>         <inc_para>Para1 from include_test</inc_para>
>         <inc_para>Para2 from include_test</inc_para>
> </inc_test>
> </content>
> 
> When I set it on I get error:
> 
> Error creating the resource,
> java.lang.NullPointerException
>                    java.lang.Throwable()
>                    java.lang.Exception()
>                    org.xml.sax.SAXException(java.lang.Exception)
>                    void
> org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource)
>                    void
> org.apache.cocoon.components.parser.XercesParser.parse(org.xml.sax.InputSource)
>                    void
> org.apache.cocoon.generation.FileGenerator.generate()
>                    boolean
> org.apache.cocoon.sitemap.ResourcePipeline.process(org.apache.cocoon.environment.Environment)...
> 
> When I change stylesheet by commenting out the copy template, output is:
> 
> <content xmlns:base="http://www.w3.org/XML/1998/namespace"
> xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"><inc_page>
>         <inc_title>This is coming from inside include_me.xml</inc_title>
> </inc_page><para>This part is from include2page.xsl</para>
>         Title from include_test
>         Para1 from include_test
>         Para2 from include_test
> </content>
> 
> So Xinclude doesn't like copy template.
> 
> Is this problem with Xalan or Xinclude transformer or what?
> 
> Another thing, Xinclude transformer doesn't get setDocumentLocator call
> when using it in stylesheet, thus need to put path in base attribute. Is
> this the way it should be?
> 
> Thanks,
>   Lassi Immonen



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

__________________________________________________
Do You Yahoo!?
Mime
View raw message