Re: [xsl] Re: XSLT-driven syntax highlighting for XPath 2.0, XSLT 2.0 and XSD 1.1

Subject: Re: [xsl] Re: XSLT-driven syntax highlighting for XPath 2.0, XSLT 2.0 and XSD 1.1
From: Philip Fearon <pgfearo@xxxxxxxxxxxxxx>
Date: Tue, 11 Dec 2012 22:36:01 +0000
@Jirka, Mansour thanks for this information on xslthl - I've had a
chance to look at some of the documentation and examples now.

This seems well suited to DocBook publishers restricted to using XSLT
1.0 processing (which appears right now from the Docbook forum to be
the majority) - XMLSpectrum requires XSLT 2.0. It is much more
flexible because of its generic design, accommodating a significant
number of programming languages out of the box and having a fair level
of extensibility for other languages (but probably not for XPath
because of issues such as the lack of reserved keywords and the
support for nested comments).

It has already been mentioned here that xslthl can highlight XSLT but
not XPath, more seriously though - I believe it is using an XML parser
which is unable to preserve inter/intra attribute formatting of the
code (as this is a none-requirement in the spec).

In my experience when reviewing non-trivial XPath 2.0, I can manage
farily well without syntax highlighting provided there is good use of
line-breaks and indentation - this gives neither.

<minor-rant>
I fear the lack of support that documentation systems (and even some
XSLT/XPath editors) provide for formatting and syntax-highlighting in
XPath 2.0 has led to a coding style that favours breaking XPath
expressions between multiple XSLT instructions; leading in turn to
criticism regarding the verbosity of XSLT. Hopefully, things will
improve (there are signs of this) before XPath 3.0 arrives in its
final form.
</minor-rant>

Just one more note on XMLSpectrum support for XSLT 2.0 formatting:

I think I mentioned earlier that the XSLT editor I use doesn't pad XML
with indentation characters - instead it uses a dynamic margin that
flows to the structure I've found this virtual formatting is great for
editing, but totally useless for documentation and review on other
systems. So, in case there are others using this technique (unlikely -
but one can hope) I've now updated XMLSpectrum with an option to
auto-indent the XSLT; this goes beyond normal XML indentation in that
the indentation of attributes and their multi-line contents is all
vertically aligned and consistent with the nesting-level - i.e. as one
would expect as if it had been hand-crafted.

Phil

On Fri, Nov 30, 2012 at 4:53 PM, Jirka Kosek <jirka@xxxxxxxx> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 30.11.2012 17:38, Mansour Al Akeel wrote:
>> There's source code highlighter for other languages, but didn't use
>> it for xml
>> http://sourceforge.net/apps/mediawiki/xslthl/index.php?title=Main_Page
>>
>>
> I am not sure if it handles xml properly.
>
> XSLTH is written in Java and there are Saxon6 and Saxon9 connectors
> which allow to invoke it from XSLT transformation. Library has been
> integrated in DocBook stylesheets, DITA-OT and DITAC.
>
> Support for XML and XSLT is decent (see example at
> http://www.kosek.cz/xml/xslt/xslt2-seskupovani.html). But XSLTHL
> doesn't parse and colorize XPath expressions embeded inside XSLT.
> Phil's code looks really interesting. I'm tempted to use it for my
> tomorrow's XSLT 2.0 slides, but I should rather work on my slides
> first :-)
>
>                                 Jirka
>
> - --
> - ------------------------------------------------------------------
>   Jirka Kosek      e-mail: jirka@xxxxxxxx      http://xmlguru.cz
> - ------------------------------------------------------------------
>        Professional XML consulting and training services
>   DocBook customization, custom XSLT/XSL-FO document processing
> - ------------------------------------------------------------------
>  OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
> - ------------------------------------------------------------------
>     Bringing you XML Prague conference    http://xmlprague.cz
> - ------------------------------------------------------------------
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.17 (MingW32)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
>
> iEYEARECAAYFAlC45G0ACgkQzwmSw7n0dR68fgCeMGNyBRHNvoOajEaiKcISKqRn
> C4sAnR+dvXEuWVbX7SSPuD/pfA4CF3mk
> =kRrD
> -----END PGP SIGNATURE-----

Current Thread