Project

Profile

Help

Feature #5613

closed

Saxon-EE profiling HTML not well-formed

Added by Oliver Budke almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Command Line
Sprint/Milestone:
-
Start date:
2022-07-20
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Java

Description

Running Saxon-EE with "-TP" option for profiling produces a not well-formed HTML document. The element /html/head/meta is not terminated with a closing tag.

I am running Saxon-EE 9.9.1.7 in Oxygen XML Editor 23.1

Actions #1

Updated by Michael Kay over 1 year ago

In HTML (as distinct from XHTML), no closing tag is required for meta elements. See https://stackoverflow.com/questions/19506028/do-you-need-to-close-meta-and-link-tags-in-html

Unfortunately the TimingTraceListener isn't really designed to be customised, except by taking a copy of the source code and adapting it to produce your own version. I'll look at making some methods overridable, or providing some other way to capture the results into a user-supplied stylesheet.

Actions #2

Updated by Oliver Budke over 1 year ago

Thank you for your explanation.

Is there any other way to obtain a trace listener output that is readable by an XSL transformation, i.e. producing a well-formed XML document? I need a list of all templates that have been called and use this information for another transformation.

Regards
Oliver Budke
]init[ AG für digitale Kommunikation

Actions #3

Updated by Michael Kay over 1 year ago

I would suggest writing your own TraceListener to capture this information; you could do this by modifying the source code of TimingTraceListener, which can be found at

https://saxonica.plan.io/projects/saxonmirrorhe/repository/he/entry/src/main/java/net/sf/saxon/trace/TimingTraceListener.java?utf8=✓&rev=saxon11

Alternatively, you can read HTML in a transformation by using the saxon:parse-html() extension function, or by setting up a SAXSource that uses TagSoup or validator.nu as the XMLReader. But this is a "screen-scraping" approach in which you become dependent on the detailed format of the HTML output, which is not stable or documented.

Actions #4

Updated by Oliver Budke over 1 year ago

Thank you. I will try to implement the first approach then.

Actions #5

Updated by Oliver Budke over 1 year ago

I tried a couple of things with the TimingTraceListener. However, I cannot find the stylesheet profile.xsl which is called on line 242. Could you provide me the file that I can make my necessary changes there? It seems easiest for my production environment to just output an xhtml file.

Actions #6

Updated by Michael Kay over 1 year ago

You can find it at

https://saxonica.plan.io/projects/saxonmirrorhe/repository/he/revisions/saxon11/entry/src/main/resources/net/sf/saxon/data/profile.xsl

Incidentally, next to it there is a profile-json.xsl, which I suspect was an attempt to allow the timing data to be output in JSON, but I don't know if this was ever tested.

Actions #7

Updated by Michael Kay over 1 year ago

  • Tracker changed from Bug to Feature
  • Category set to Command Line
  • Status changed from New to Closed
  • Assignee set to Michael Kay
  • Platforms Java added

For 12.x I have implemented a new command-line option -TPxsl:filename which allows you to supply your own stylesheet for formatting the performance profile. This allows you to output the data in XML or JSON, or to display it more selectively, or for example to write a plug-in that integrates the data into the display of an IDE.

Please register to edit this issue

Also available in: Atom PDF