This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 30012 - [xslt30] Syntax highlighting
Summary: [xslt30] Syntax highlighting
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-17 16:59 UTC by Michael Kay
Modified: 2016-11-18 18:27 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2016-11-17 16:59:22 UTC
Comments from Phil Fearon:

I’ve just had a quick look at your sample. I like the new style.

A couple of things I noticed which I imagine you’re already aware of,  I also encountered these minor problems:

1. The jsp samples (jsp:setProperty) are corrupted by the XSLT rendering, they should instead use the qf:show-xquery(.) function - which treats the jsp more sympathetically as an XQuery element constructor. This is illustrated in the highlight-inline.xsl changes.
2. The json snippets should also be rendered using qf:show-xquery(.) - they’re treated as map constructors.
2. Syntax definitions containing ‘::=‘ are problematic and should probably be skipped by the highlighter
3. The XML Schema included in H.1 line-wraps which affects formatting - you could use XMLSpectrum’s ‘auto-trim=yes’ and ‘indent=2’ xsl parameters to reformat this to take up less space, even if you don’t need the syntax-highlighting here, XMLSpectrum’s formatting is described here: https://github.com/pgfearo/xmlspectrum/wiki/XSLT-Formatting


Phil
Comment 1 Phil Fearon 2016-11-17 17:31:19 UTC
An addition to the descripton: 

XPath/XQeury expressions included as stand-alone samples should also be processed using qf:show-xquery().

A general rule for syntax-highlighting code content with XMLSpectrum is that, when ignoring whitespace, if the first character is a '<' use f:render(), otherwise use qf:show-xquery().

The exception to this rule is code starting with '<jsp:setProperty'. This code should not be parsed as XML (it nests elements within string-literals) so qf:show-xquery() should be used instead.
Comment 2 Michael Kay 2016-11-18 17:05:56 UTC
Thanks. I have dealt with points 1, 2, and 2bis pragmatically - they affected very few examples.

Point 3 was more problematic. I played with the idea of displaying the schema in the fixed-width space available using a smaller font, but controlling <pre> output seems to be very browser-dependent. In the end I resorted to writing a custom stylesheet to reformat the schema to a shorter line-length - the final stage of reformatting long attribute values being done by hand.