xsl-list
[Top] [All Lists]

RE: [xsl] XSLT 2.0: Saxon et. al.: Tracking XML source line numbers

2007-07-18 12:19:15
and have the SAX filter fabricate 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?

Yes (well, at any rate, every time you *compile* the final XSLT). You could
consider using the Saxon facility to save the compiled XSLT on disk.

It's quite a common scenario with XSLT stylesheet generation to generate a
new stylesheet for each run, but I agree it's not the only one.


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). 

I'd suggest generating a stylesheet that's pure XSLT plus added
my:line-number attributes. Then write a SAX filter which you put between the
XML parser and the XSLT processor, and which feeds Saxon the faked line
numbers from these attributes.

You certainly don't need to change a line of Saxon code to achieve this: you
can even do it using pure JAXP interfaces.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--