You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Victoria Vitaver <vi...@tt.com.au> on 2005/07/01 03:39:47 UTC

Transformation problem - browser specific

Hi,

I have a few problems stemming from including a javascript file into my
publication which is based on the default publication.

I have created a custom xsl sheet based on page2xhtml.xsl (only a small
difference in the includes). Inside the xsl sheet, to include a javascript
file, I do '<script src="../scripts/calendar.js"> </script>'

Inside my sitemap[1] I do :

<map:match pattern="**/*.js">
	<map:read mime-type="text/javascript"
                   src="resources/shared/scripts/{2}.js"/>
</map:match>


My problems:

1. In the IE 6.0 browser I get an 'xml' view of the file. When I save 
the file and open that, I get a blank page. When I correct <script 
src="../scripts/calendar.js/"> (which has been somehow somewhere applied 
instead of my code)   to <script src="../scripts/calendar.js> </scripts>
and open that file it all displays fine, with no javascript errors.


2. In the Firefox browser I keep on getting javascript errors, ( 
element.style does not have properties) BUT I am sure that the script is 
'correct' as it runs happily on the Firefox browser in a different 
application.


I'd really appreciate any hints on what I could be doing wrong in my 
pipeline to make my browsers so unhappy :(

Thanks in advance,

- vica

-----------
[1] snippet of my publication-sitemap.xmap

...

<map:pipeline>
     <map:match pattern="**/search.htm">
         <map:aggregate element="cmsbody">
	    <map:part 
src="cocoon://navigation/{page-envelope:publication-id}/{page-envelope:area}/breadcrumb/index.xml"/>
	    <map:part 
src="cocoon://navigation/{page-envelope:publication-id}/{page-envelope:area}/tabs/index.xml"/>
	    <map:part 
src="cocoon://navigation/{page-envelope:publication-id}/{page-envelope:area}/menu/index.xml"/>
	    <map:part src="xsp/searchPage.xml"/>
         </map:aggregate>
	<map:transform src="xsp/searchPage.xsl">
	    <map:parameter name="area" value="{page-envelope:area}"/>
	    <map:parameter name="root" 
value="{page-envelope:context-prefix}/{page-envelope:publication-id}"/>
	    <map:parameter name="img_source" value="images/calendar.gif"/>
	</map:transform>
         <map:transform src="xslt/page2xhtml-xsp.xsl">
           <map:parameter name="root" 
value="{page-envelope:context-prefix}/{page-envelope:publication-id}/{page-envelope:area}"/>
	  <map:parameter name="document-id" value="/index"/>
	  <map:parameter name="url" value="{page-envelope:area}/index.html"/>
	  <map:parameter name="language" 
value="{page-envelope:document-language}"/>
         </map:transform>
	<map:serialize type="xml"/>
     </map:match>	

     <map:match pattern="**/*.js">
     	<map:read mime-type="text/javascript" 
src="resources/shared/scripts/{2}.js"/>
     </map:match>

     </map:pipeline>

etc...


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by Victoria Vitaver <vi...@tt.com.au>.
>>> a. IE just displaying a XML representation of my desired website 
>>> instead of the HTML representation
>>
>>
>>
>> Did you notice:
>>      <map:match pattern="**/search.htm">
>> ...
>>         <map:serialize type="xml"/>
>>     </map:match>
>>
>> If you want HTML, it should be:
>>         <map:serialize type="html"/>
> 
> 
> Yes, I thought it might be that ... but .. when I change it to html I 
> get a Null Pointer Exception [1] :/
> I really dont understand why I get a null pointer exception out of this 
> change ?!
> (Thats why I kept it as 'xml' for the time being, contrary to my better 
> judgment)
> 

Probelm resolved: I now set my document-type to be "text/html" and it 'works'.

I still serialize to xml as it doesn't get rid of my error when I try to serialize to html, but at least now my page is displayed on IE.

Thank you for your help.

Vica

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by Victoria Vitaver <vi...@tt.com.au>.
>>a. IE just displaying a XML representation of my desired website instead of the HTML representation
> 
> 
> Did you notice:
>      <map:match pattern="**/search.htm">
> ...
>         <map:serialize type="xml"/>
>     </map:match>
> 
> If you want HTML, it should be:
>         <map:serialize type="html"/>

Yes, I thought it might be that ... but .. when I change it to html I get a Null Pointer Exception [1] :/
I really dont understand why I get a null pointer exception out of this change ?!
(Thats why I kept it as 'xml' for the time being, contrary to my better judgment)
 
> I just tested your JS Match with Jetty, but my URLs do not have
> "/lenya" so it would act like your URLs using Tomcat.

Yes you are right, I am using Tomcat, sorry for not specifying it earlier.

> <SCRIPT LANGUAGE="JAVASCRIPT" SRC="/mypub/resource/shared/scripts/test.js"/>
> became:
> <SCRIPT SRC="/mypub/resource/shared/scripts/test.js"
> LANGUAGE="JAVASCRIPT"></SCRIPT>
> 
> <SCRIPT LANGUAGE="JAVASCRIPT" SRC="../scripts/test.js"/>
> became
> <SCRIPT SRC="../scripts/test.js" LANGUAGE="JAVASCRIPT"></SCRIPT>

Funny .. must be different versions interpreting things differently.

> Both tests worked in MSIE6.0 and Mozilla1.7.3 (using Lenya 1.2.2.  You
> are using later releases?)
I am using MSIE6.0 and Firefox 1.0.4 and Lenya 1.2.3.

Thank you for your help.

Vica
 
> solprovider


----

[1]
cause: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException

full exception chain stacktrace:
org.apache.cocoon.ProcessingException: Error executing pipeline.: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.handleException(AbstractProcessingPipeline.java:940)
	at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:281)
	at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:483)
	at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:120)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:46)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:138)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:68)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:92)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:234)
	at org.apache.cocoon.components.treeprocessor.ConcreteTreeProcessor.process(ConcreteTreeProcessor.java:176)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:243)
etc ...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by so...@gmail.com.
On 7/1/05, Victoria Vitaver <vi...@tt.com.au> wrote:
> The script is visible so thats not the problem (however my URL = http://localhost:8080/lenya/demo/authoring/search.htm),
> I'm more concerned about
> a. IE just displaying a XML representation of my desired website instead of the HTML representation

Did you notice:
     <map:match pattern="**/search.htm">
...
        <map:serialize type="xml"/>
    </map:match>

If you want HTML, it should be:
        <map:serialize type="html"/>

> b. the <script .. /> having such profound effects ...
http://localhost:8080/lenya/demo/authoring/search.htm
+
../scripts/calendar.js
=
http://localhost:8080/lenya/demo/scripts/calendar.js

Is this on Tomcat or Jetty?

Tomcat should strip the "lenya" and use your match to look for:
{pub:demo}/resources/shared/scripts/calendar.js

Jetty would match on "lenya" and go looking for:
lenya/webapp/lenya/resources/demo/scripts/calendar.js

I just tested your JS Match with Jetty, but my URLs do not have
"/lenya" so it would act like your URLs using Tomcat.

<SCRIPT LANGUAGE="JAVASCRIPT" SRC="/mypub/resource/shared/scripts/test.js"/>
became:
<SCRIPT SRC="/mypub/resource/shared/scripts/test.js"
LANGUAGE="JAVASCRIPT"></SCRIPT>

<SCRIPT LANGUAGE="JAVASCRIPT" SRC="../scripts/test.js"/>
became
<SCRIPT SRC="../scripts/test.js" LANGUAGE="JAVASCRIPT"></SCRIPT>

Both tests worked in MSIE6.0 and Mozilla1.7.3 (using Lenya 1.2.2.  You
are using later releases?)

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by Victoria Vitaver <vi...@tt.com.au>.
Martin Heiden wrote:
> Vica!
> 
> Am Freitag, 1. Juli 2005 um 09:38:54 haben Sie geschrieben:
> 
> 
>>Thats what I would have thought BUT my IE is being really funny
>>about it, its not liking it that way and only displays the page when
>>I have
>><script src="../scripts/calendar.js"> </script>, hence why I want
>>to find out where its being converted to <script
>>language="JavaScript" src="../scripts/calendar.js"/>
> 
> 
> Try to put something inside your script-tag. I asked a similar
> question here a few days ago. Didn't have the time to test it yet, but
> I'm pretty sure that it will do the trick: Put a &#160; inside the
> tag.
> 
> If you use a XHTML doctype, your <script> needs the type attribute
> (it's mandatory). Language isn't part of the specs.
> 
> Martin.
> 
> 
Thank you Martin, that did it :)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by Martin Heiden <ma...@devk.de>.
Vica!

Am Freitag, 1. Juli 2005 um 09:38:54 haben Sie geschrieben:

> Thats what I would have thought BUT my IE is being really funny
> about it, its not liking it that way and only displays the page when
> I have
> <script src="../scripts/calendar.js"> </script>, hence why I want
> to find out where its being converted to <script
> language="JavaScript" src="../scripts/calendar.js"/>

Try to put something inside your script-tag. I asked a similar
question here a few days ago. Didn't have the time to test it yet, but
I'm pretty sure that it will do the trick: Put a &#160; inside the
tag.

If you use a XHTML doctype, your <script> needs the type attribute
(it's mandatory). Language isn't part of the specs.

Martin.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by Victoria Vitaver <vi...@tt.com.au>.
>>I have created a custom xsl sheet based on page2xhtml.xsl (only a small
>>difference in the includes). Inside the xsl sheet, to include a javascript
>>file, I do '<script src="../scripts/calendar.js"> </script>'
> 
> 
> Javascript issues should be a problem with XSL, not the XMAP.  You
> forgot the language parameter, and you shouldn't have a separate close
> tag with the src parameter.  

Thats what I would have thought BUT my IE is being really funny about it, its not liking it that way and only displays the page when I have
<script src="../scripts/calendar.js"> </script>, hence why I want to find out where its being converted to <script language="JavaScript" src="../scripts/calendar.js"/>

Change the tag to:
> <script language="JavaScript" src="../scripts/calendar.js"/>

Unfortunately that doesnt do anything :(

> If that does not fix everything, we need to know the URL so we can see
> what adding ../scripts/calendar.js makes so we can trace through the
> sitemaps.

The script is visible so thats not the problem (however my URL = http://localhost:8080/lenya/demo/authoring/search.htm), 
I'm more concerned about 
a. IE just displaying a XML representation of my desired website instead of the HTML representation
and 
b. the <script .. /> having such profound effects ... 


> I haven't checked Firefox, but Mozilla has a JS console that may help
> with debugging.  (Not the JS Debugger; I never figured out how to do
> anything productive with that.)

Thank you, I am already using the debuggers :)

Vica

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by so...@gmail.com.
On 6/30/05, Victoria Vitaver <vi...@tt.com.au> wrote:
> I have a few problems stemming from including a javascript file into my
> publication which is based on the default publication.
> 
> I have created a custom xsl sheet based on page2xhtml.xsl (only a small
> difference in the includes). Inside the xsl sheet, to include a javascript
> file, I do '<script src="../scripts/calendar.js"> </script>'

Javascript issues should be a problem with XSL, not the XMAP.  You
forgot the language parameter, and you shouldn't have a separate close
tag with the src parameter.  Change the tag to:
<script language="JavaScript" src="../scripts/calendar.js"/>

If that does not fix everything, we need to know the URL so we can see
what adding ../scripts/calendar.js makes so we can trace through the
sitemaps.

I haven't checked Firefox, but Mozilla has a JS console that may help
with debugging.  (Not the JS Debugger; I never figured out how to do
anything productive with that.)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by Victoria Vitaver <vi...@tt.com.au>.
Lee Carroll wrote:
>> file, I do '<script src="../scripts/calendar.js"> </script>'
>>
>> <map:match pattern="**/*.js">
>>    <map:read mime-type="text/javascript"
>>                   src="resources/shared/scripts/{2}.js"/>
>> </map:match>
> 
> 
> script has a mandatory element of type.
> Clutching at straws a little but might be why.
> 
Thank you, but unfortunately that did not solve it.

-vica

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Transformation problem - browser specific

Posted by Lee Carroll <le...@aol.com>.
> file, I do '<script src="../scripts/calendar.js"> </script>'
> 
> <map:match pattern="**/*.js">
>    <map:read mime-type="text/javascript"
>                   src="resources/shared/scripts/{2}.js"/>
> </map:match>

script has a mandatory element of type.
Clutching at straws a little but might be why.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org