[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSLT 2.0: Saxon et. al.: Tracking XML source line

Subject: RE: XSLT 2.0: Saxon et. al.: Tracking XML source line numbers
From: Justin Johansson <procode@xxxxxxxxxx>
Date: Wed, 18 Jul 2007 19:52:08 +0900
RE:  XSLT 2.0: Saxon et. al.: Tracking XML source line
>> C and C++ preprocessors have long had the ability for the 
>> programmer to modify the file name and line numbers for which 
>> the compiler outputs errors and warnings associated with source code.

>> Apparently some other languages, e.g. Perl, have a similar 
>> facility but what about XSLT?

>It would certainly be possible to implement such a mechanism by inserting a
>SAX filter between the XML parser and the XSLT processor, and have the SAX
>filter fabricate the line numbers. In fact, if the stylesheet generator is
>feeding the generated stylesheet to the XSLT processor directly as a SAX
>stream, then it takes full responsility for supplying the line numbers.

Interesting suggestion, Michael.  However wouldn't that require the
stylesheet generator to be run every time you want to run the final XSLT?
I cannot imagine, for example, wanting to have to run a YACC processor on a
grammar file every time I run the compiler that was generated.

In my scenario, I have a higher level language called Y which is translated
into XSLT.  This is done once only to produce a static stylesheet (i.e. an
XSLT file on disk).  The static stylesheet will run many times, perhaps
once every time a web page is called up to be rendered in HTML, PDF or
whatever.  So I'm beginning to think there are only two viable options :-

1. Use saxon:line-number in the XSLT generator that generates the XSLT from
Y to put line-number attributes on elements in the resultant XSLT.
2. Use saxon:line-number in the XSLT generator that generates the XSLT from
Y to generate a line-number cross-reference file in addition to the
generated XSLT.

Either way, I would still need to hook the error message processing in the
XSLT processor to do either the line number lookup from the attribute on
the element as in 1 or to consult the cross-reference file as in 2.

I'm savvy enough with Java to make the appropriate mods to Saxon but don't
like the idea of producing a private version of Saxon from SourceForge
sources and being out on a limb.

Justin Johansson
Freelance XML / XSLT / XQuery Developer
Australia

procode(at)tpg(dot)com(dot)au

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.