agusantoso / harviewer

Automatically exported from code.google.com/p/harviewer
0 stars 0 forks source link

xslt Processing markup and rendering issues #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After building using Apache Ant there are some markup errors that prevent
the xhtml from being rendered properly.

Details are at
http://code.google.com/p/harviewer/issues/detail?id=8#c12
http://code.google.com/p/harviewer/issues/detail?id=8#c14

I suspect these issues are due to the xslt files 
http://code.google.com/p/harviewer/source/browse/trunk/xslt/index.xsl
http://code.google.com/p/harviewer/source/browse/trunk/xslt/loader.xsl
http://code.google.com/p/harviewer/source/browse/trunk/xslt/pagelist.xsl

When ant goes about and does it's thing it processes them and changes some
tags like the following below. Could this be due to the XHTML strict.dtd
declaration or maybe simply the xslt instructions and possibly it's trying
to make the markup TOO valid since that looks like proper xml?

<script type="text/javascript" src="har.js"></script>
to 
<script src="har.js" type="text/javascript" />

and 
<textarea id="sourceEditor" class="sourceEditor" cols="80" rows="5"></textarea>
to
<textarea id="sourceEditor" class="sourceEditor" cols="80" rows="5" />

additionally some of the @VERSION@ tags do not get changed.

Original issue reported on code.google.com by anthony....@gmail.com on 6 May 2010 at 5:16

GoogleCodeExporter commented 9 years ago
read these for possible solutions/workarounds

http://stackoverflow.com/questions/336670/explicit-script-end-tag-always-convert
ed-to-self-closing

http://forum.umbraco.org/yaf_postsm9576_javascript-included-in-xslt-gives-a-stra
nge-ajax-net-error.aspx

Original comment by anthony....@gmail.com on 6 May 2010 at 6:10

GoogleCodeExporter commented 9 years ago
I can't reproduce the problem with missing </script>. For me the closing tag is
properly generated in the result index.php (for har.js file). Could this be OS
specific problem?

Anyway, following new comment ("A comment to ensure closing tag creation.") in
index.xslt could help. If you verify that it solves the problem in your machine 
I'll
commit.

<xsl:template match="xhtml:head">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
    <link rel="StyleSheet" href="har.css" type="text/css"/>
    <script type="text/javascript" src="har.js">
        // A comment to ensure closing tag creation.
    </script>
    <!-- The excanvas script is inserted within MS if clause -->
    <xsl:comment><![CDATA[[if IE]><script type="text/javascript"
src="excanvas/excanvas.compiled.js"></script><![endif]]]></xsl:comment>
  </xsl:copy>
</xsl:template>

> additionally some of the @VERSION@ tags do not get changed.
I also can't see this problem. Which @VERSION@ is specifically missing?

Honza

Original comment by odva...@gmail.com on 9 May 2010 at 8:51

GoogleCodeExporter commented 9 years ago
>> additionally some of the @VERSION@ tags do not get changed.
> I also can't see this problem. Which @VERSION@ is specifically missing?
I think I have fixed this at R104.
Honza

Original comment by odva...@gmail.com on 10 May 2010 at 9:26

GoogleCodeExporter commented 9 years ago
Sorry for the long post in advance :)

Simply adding a comment is not going to cut it in my case and it's most 
definately
due to the ANT package classes I have on my system and possibly configuration 
issues
which I am still trying to work out.

When I remade with prior revision than R104 I instead tried using ant -verbose 
for
more detail and I got a warning that I hadn't seen earlier.

     [xslt] Using class org.apache.tools.ant.taskdefs.optional.TraXLiaison
     [xslt] Processing /tmp/harviewer/index.php to /tmp/harviewer/release/index.php
     [xslt] Loading stylesheet /tmp/harviewer/xslt/index.xsl
Apache resolver library not found, internal resolver will be used

So after some searching I figured out that it could be do to the xml resolver 
used. 
http://xml.apache.org/commons/

I ended up installing these
$ yum install ant-apache-resolver.x86_64

Which yum then told me to install this dependency which I did:
 xml-commons-resolver    x86_64     1.1-1jpp.12      base              170 k

Then I tried remaking and I didn't get the "Apache resolver library not found"
message this time but it still didn't fix the issue with the broken tags. 
Here's the
new message i got for those build lines:

     [xslt] Using class org.apache.tools.ant.taskdefs.optional.TraXLiaison
     [xslt] Processing /tmp/harviewer/index.php to /tmp/harviewer/release/index.php
     [xslt] Loading stylesheet /tmp/harviewer/xslt/index.xsl
Apache resolver library found, xml-commons resolver will be used

More searching and found in my /usr/share/java/ folder two xalan-j2 jars which I
thought were depreciated. I don't know enough about java to start playing with 
this
but I heard from some thread online that sometimes ant uses an incorrectly 
installed
or rather left over installation of resolver class.
http://marc.info/?l=ant-user&m=114935967822026

I ran "ant -diagnostics" and noticed this line:

mmetrics : Missing dependency
org.apache.tools.ant.taskdefs.optional.metamata.AbstractMetamataTask

So I installed 
 ant-nodeps              x86_64     1.6.5-2jpp.2     base              900 k

Which fixed the dependency and rebuilt and still got the same outcome.

I also have this in my ant -diagnostic report, which is peculiar since I 
thought I
installed the common library and apache xml thing.

 org.apache.env.Which diagnostics
-------------------------------------------
Not available.
Download it at http://xml.apache.org/commons/

Maybe you can run "ant -diagnostics" on your machine and post it so I can see 
what
classes you got running while you build.

Original comment by anthony....@gmail.com on 17 May 2010 at 11:47

GoogleCodeExporter commented 9 years ago
I also tried building with R106 today and got unlreated errors like missing 
images
and files.

[root@server /tmp/harviewer]ant -v
Apache Ant version 1.6.5 compiled on January 6 2007
Buildfile: build.xml
Detected Java version: 1.5 in: 
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre
Detected OS: Linux
parsing buildfile /tmp/harviewer/build.xml with URI = 
file:///tmp/harviewer/build.xml
Project base dir set to: /tmp/harviewer
 [property] Loading /tmp/harviewer/ant.properties
Build sequence for target(s) `build' is [clean, build]
Complete build sequence is [clean, build, ]

clean:

build:
    [mkdir] Created dir: /tmp/harviewer/release
     [copy] browser-blocking-time.har added as browser-blocking-time.har doesn't exist.
     [copy] google.com.har added as google.com.har doesn't exist.
     [copy] inline-scripts-block.har added as inline-scripts-block.har doesn't exist.
     [copy] softwareishard.com.har added as softwareishard.com.har doesn't exist.
     [copy] Copying 4 files to /tmp/harviewer/release/examples
     [copy] Copying /tmp/harviewer/examples/browser-blocking-time.har to
/tmp/harviewer/release/examples/browser-blocking-time.har
     [copy] Copying /tmp/harviewer/examples/softwareishard.com.har to
/tmp/harviewer/release/examples/softwareishard.com.har
     [copy] Copying /tmp/harviewer/examples/inline-scripts-block.har to
/tmp/harviewer/release/examples/inline-scripts-block.har
     [copy] Copying /tmp/harviewer/examples/google.com.har to
/tmp/harviewer/release/examples/google.com.har
     [copy] bg-button.gif added as bg-button.gif doesn't exist.
     [copy] button-background.png added as button-background.png doesn't exist.
     [copy] close-sprites.png added as close-sprites.png doesn't exist.
     [copy] download-sprites.png added as download-sprites.png doesn't exist.
     [copy] group.gif added as group.gif doesn't exist.
     [copy] loading_16.gif added as loading_16.gif doesn't exist.
     [copy] netBarBlocking.gif added as netBarBlocking.gif doesn't exist.
     [copy] netBarBlocking2.gif added as netBarBlocking2.gif doesn't exist.
     [copy] netBarCached.gif added as netBarCached.gif doesn't exist.
     [copy] netBarConnecting.gif added as netBarConnecting.gif doesn't exist.
     [copy] netBarLoaded.gif added as netBarLoaded.gif doesn't exist.
     [copy] netBarReceiving.gif added as netBarReceiving.gif doesn't exist.
     [copy] netBarResolving.gif added as netBarResolving.gif doesn't exist.
     [copy] netBarResponded.gif added as netBarResponded.gif doesn't exist.
     [copy] netBarSending.gif added as netBarSending.gif doesn't exist.
     [copy] netBarWaiting.gif added as netBarWaiting.gif doesn't exist.
     [copy] page-timeline.png added as page-timeline.png doesn't exist.
     [copy] tabEnabled.png added as tabEnabled.png doesn't exist.
     [copy] timeline-sprites.png added as timeline-sprites.png doesn't exist.
     [copy] tooltipConnectorUp.png added as tooltipConnectorUp.png doesn't exist.
     [copy] twisty-sprites.png added as twisty-sprites.png doesn't exist.
     [copy] twistyClosed.png added as twistyClosed.png doesn't exist.
     [copy] twistyOpen.png added as twistyOpen.png doesn't exist.
     [copy] Copying 23 files to /tmp/harviewer/release/images
     [copy] Copying /tmp/harviewer/images/button-background.png to
/tmp/harviewer/release/images/button-background.png
     [copy] Copying /tmp/harviewer/images/close-sprites.png to
/tmp/harviewer/release/images/close-sprites.png
     [copy] Copying /tmp/harviewer/images/netBarResolving.gif to
/tmp/harviewer/release/images/netBarResolving.gif
     [copy] Copying /tmp/harviewer/images/download-sprites.png to
/tmp/harviewer/release/images/download-sprites.png
     [copy] Copying /tmp/harviewer/images/twisty-sprites.png to
/tmp/harviewer/release/images/twisty-sprites.png
     [copy] Copying /tmp/harviewer/images/netBarCached.gif to
/tmp/harviewer/release/images/netBarCached.gif
     [copy] Copying /tmp/harviewer/images/netBarResponded.gif to
/tmp/harviewer/release/images/netBarResponded.gif
     [copy] Copying /tmp/harviewer/images/twistyOpen.png to
/tmp/harviewer/release/images/twistyOpen.png
     [copy] Copying /tmp/harviewer/images/group.gif to
/tmp/harviewer/release/images/group.gif
     [copy] Copying /tmp/harviewer/images/twistyClosed.png to
/tmp/harviewer/release/images/twistyClosed.png
     [copy] Copying /tmp/harviewer/images/netBarReceiving.gif to
/tmp/harviewer/release/images/netBarReceiving.gif
     [copy] Copying /tmp/harviewer/images/page-timeline.png to
/tmp/harviewer/release/images/page-timeline.png
     [copy] Copying /tmp/harviewer/images/netBarBlocking.gif to
/tmp/harviewer/release/images/netBarBlocking.gif
     [copy] Copying /tmp/harviewer/images/netBarSending.gif to
/tmp/harviewer/release/images/netBarSending.gif
     [copy] Copying /tmp/harviewer/images/timeline-sprites.png to
/tmp/harviewer/release/images/timeline-sprites.png
     [copy] Copying /tmp/harviewer/images/netBarBlocking2.gif to
/tmp/harviewer/release/images/netBarBlocking2.gif
     [copy] Copying /tmp/harviewer/images/loading_16.gif to
/tmp/harviewer/release/images/loading_16.gif
     [copy] Copying /tmp/harviewer/images/tooltipConnectorUp.png to
/tmp/harviewer/release/images/tooltipConnectorUp.png
     [copy] Copying /tmp/harviewer/images/netBarConnecting.gif to
/tmp/harviewer/release/images/netBarConnecting.gif
     [copy] Copying /tmp/harviewer/images/netBarLoaded.gif to
/tmp/harviewer/release/images/netBarLoaded.gif
     [copy] Copying /tmp/harviewer/images/bg-button.gif to
/tmp/harviewer/release/images/bg-button.gif
     [copy] Copying /tmp/harviewer/images/tabEnabled.png to
/tmp/harviewer/release/images/tabEnabled.png
     [copy] Copying /tmp/harviewer/images/netBarWaiting.gif to
/tmp/harviewer/release/images/netBarWaiting.gif
     [copy] Copying 1 file to /tmp/harviewer/release
     [copy] Copying /tmp/harviewer/schema.js to /tmp/harviewer/release/schema.js
     [copy] Copying 1 file to /tmp/harviewer/release
     [copy] Copying /tmp/harviewer/license.txt to /tmp/harviewer/release/license.txt
     [copy] Copying 1 file to /tmp/harviewer/release
     [copy] Copying /tmp/harviewer/ReleaseNotes.txt to
/tmp/harviewer/release/ReleaseNotes.txt
[compress-js] Compress JS task provided by LCA Soft Ltd (www.lcasoft.com).
Ignoring Exception java.util.zip.ZipException: error in opening zip file reading
resource org/mozilla/javascript/VMBridge_custom.class from
/tmp/harviewer/build-tools/dojo/shrink-safe/custom_rhino_charset.jar
[compress-js] Compressing 20 files to /tmp/harviewer/release/temp
[compress-js] 20 files compressed.
     [move] Moving 1 file to /tmp/harviewer/release/temp
     [move] Attempting to rename:
/tmp/harviewer/release/temp/har.core.preprocessed.js to
/tmp/harviewer/release/temp/har.core.js
    [jsmin] Minimizing /tmp/harviewer/domplate.min.js
     [move] Moving 1 file to /tmp/harviewer/release/temp
     [move] Attempting to rename: /tmp/harviewer/domplate.min.js to
/tmp/harviewer/release/temp/domplate.js
     [copy] domView.css added as domView.css doesn't exist.
     [copy] har.page.stats.css added as har.page.stats.css doesn't exist.
     [copy] har.page.timeline.css added as har.page.timeline.css doesn't exist.
     [copy] highlight.css added as highlight.css doesn't exist.
     [copy] infoTip.css added as infoTip.css doesn't exist.
     [copy] net.css added as net.css doesn't exist.
     [copy] pageRep.css added as pageRep.css doesn't exist.
     [copy] schemaRep.css added as schemaRep.css doesn't exist.
     [copy] tabView.css added as tabView.css doesn't exist.
     [copy] viewer.css added as viewer.css doesn't exist.
     [copy] Copying 10 files to /tmp/harviewer/release/temp
     [copy] Copying /tmp/harviewer/domView.css to /tmp/harviewer/release/temp/domView.css
     [copy] Copying /tmp/harviewer/tabView.css to /tmp/harviewer/release/temp/tabView.css
     [copy] Copying /tmp/harviewer/infoTip.css to /tmp/harviewer/release/temp/infoTip.css
     [copy] Copying /tmp/harviewer/har.page.timeline.css to
/tmp/harviewer/release/temp/har.page.timeline.css
     [copy] Copying /tmp/harviewer/viewer.css to /tmp/harviewer/release/temp/viewer.css
     [copy] Copying /tmp/harviewer/highlight.css to
/tmp/harviewer/release/temp/highlight.css
     [copy] Copying /tmp/harviewer/schemaRep.css to
/tmp/harviewer/release/temp/schemaRep.css
     [copy] Copying /tmp/harviewer/net.css to /tmp/harviewer/release/temp/net.css
     [copy] Copying /tmp/harviewer/har.page.stats.css to
/tmp/harviewer/release/temp/har.page.stats.css
     [copy] Copying /tmp/harviewer/pageRep.css to /tmp/harviewer/release/temp/pageRep.css
     [copy] Copying 1 file to /tmp/harviewer/release/temp
     [copy] Copying /tmp/harviewer/dojo.js to /tmp/harviewer/release/temp/dojo.js
     [copy] Copying 1 file to /tmp/harviewer/release/temp
     [copy] Copying /tmp/harviewer/har.dojo.js to /tmp/harviewer/release/temp/har.dojo.js
     [xslt] Using class org.apache.tools.ant.taskdefs.optional.TraXLiaison
     [xslt] Processing /tmp/harviewer/index.php to /tmp/harviewer/release/index.php
     [xslt] Loading stylesheet /tmp/harviewer/xslt/index.xsl
Apache resolver library found, xml-commons resolver will be used
     [xslt] tmp/harviewer/index.php:213:16: Fatal Error! The entity name must
immediately follow the '&' in the entity reference.
     [xslt] Failed to process /tmp/harviewer/index.php

BUILD FAILED
/tmp/harviewer/build.xml:122: Fatal error during transformation
        at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:552)
        at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:237)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: Fatal error during transformation
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.fatalError(TraXLiaison.java:3
46)
        at
org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java:780
)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:756)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284
)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262
)
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:13
5)
        at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:541)
        ... 13 more
Caused by: javax.xml.transform.TransformerException: The entity name must 
immediately
follow the '&' in the entity reference.
        ... 19 more
--- Nested Exception ---
Fatal error during transformation
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.fatalError(TraXLiaison.java:3
46)
        at
org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java:780
)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:756)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284
)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262
)
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:13
5)
        at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:541)
        at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:237)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: javax.xml.transform.TransformerException: The entity name must 
immediately
follow the '&' in the entity reference.
        ... 19 more
--- Nested Exception ---
; SystemID: file:///tmp/harviewer/index.php; Line#: 213; Column#: 16
javax.xml.transform.TransformerException: The entity name must immediately 
follow the
'&' in the entity reference.
        at
org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java:780
)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:756)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1284
)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1262
)
        at
org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:13
5)
        at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:541)
        at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:237)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:
40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)

Total time: 8 seconds

Original comment by anthony....@gmail.com on 17 May 2010 at 11:49

GoogleCodeExporter commented 9 years ago
I need to test this yet, but my overall feeling is that we should get rid of 
the XSLT
processing. Note that the main reason why it's there, is to rebuild <script> 
tags
used in dev version.

The dev version is using bunch of JS files that are all included into the page 
using
<script> tags. When the release version is created, JS files are compressed, 
joined
and only couple of final files is included (har.js and schema.js). Which 
requires
different <script> tags.

Originally I used XSLT, but there seems to be more problems with it. Do you 
have any
suggestions how to do this properly?

I have been thinking about PHP condition that would include proper set of 
<script>
tags depending on if it's dev or release version. The conditions could be 
driven by a
global variable, which can be set by the build.xml script.

What do you think?

Honza

Original comment by odva...@gmail.com on 18 May 2010 at 12:30

GoogleCodeExporter commented 9 years ago
The XSLT processing is removed at R109.

index.php, loader.php, pagelist.php are now just copied into the result 
'release'
directory.

Honza

Original comment by odva...@gmail.com on 30 May 2010 at 3:04

GoogleCodeExporter commented 9 years ago
This bug should be fixed in HAR 1.1-9, R188
Please verify.

Thanks for the report!
Honza

Original comment by odva...@gmail.com on 6 Jun 2010 at 7:10

GoogleCodeExporter commented 9 years ago
Sorry, the revision is: R118
Honza

Original comment by odva...@gmail.com on 6 Jun 2010 at 7:11