01: package net.sf.saxon.trace;
02:
03: import net.sf.saxon.om.NamespaceConstant;
04: import net.sf.saxon.style.StandardNames;
05:
06: /**
07: * A Simple trace listener for XSLT that writes messages (by default) to System.err
08: */
09:
10: public class XSLTTraceListener extends AbstractTraceListener {
11:
12: /**
13: * Generate attributes to be included in the opening trace element
14: */
15:
16: protected String getOpeningAttributes() {
17: return "xmlns:xsl=\"" + NamespaceConstant.XSLT + '\"';
18: }
19:
20: /**
21: * Get the trace element tagname to be used for a particular construct. Return null for
22: * trace events that are ignored by this trace listener.
23: */
24:
25: protected String tag(int construct) {
26: if (construct < 1024) {
27: return StandardNames.getDisplayName(construct);
28: }
29: switch (construct) {
30: case Location.LITERAL_RESULT_ELEMENT:
31: return "LRE";
32: case Location.LITERAL_RESULT_ATTRIBUTE:
33: return "ATTR";
34: case Location.LET_EXPRESSION:
35: return "xsl:variable";
36: case Location.EXTENSION_INSTRUCTION:
37: return "extension-instruction";
38: case Location.TRACE_CALL:
39: return "user-trace";
40: default:
41: return null;
42: }
43: }
44:
45: }
46:
47: //
48: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
49: // you may not use this file except in compliance with the License. You may obtain a copy of the
50: // License at http://www.mozilla.org/MPL/
51: //
52: // Software distributed under the License is distributed on an "AS IS" basis,
53: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
54: // See the License for the specific language governing rights and limitations under the License.
55: //
56: // The Original Code is: all this file.
57: //
58: // The Initial Developer of the Original Code is Michael H. Kay
59: //
60: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
61: //
62: // Contributor(s): none
63: //
|