KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > trace > XSLTTraceListener


1 package net.sf.saxon.trace;
2
3 import net.sf.saxon.om.NamespaceConstant;
4 import net.sf.saxon.style.StandardNames;
5
6 /**
7  * A Simple trace listener for XSLT that writes messages (by default) to System.err
8  */

9
10 public class XSLTTraceListener extends AbstractTraceListener {
11
12     /**
13      * Generate attributes to be included in the opening trace element
14      */

15
16     protected String JavaDoc 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 JavaDoc 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 //
49
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
50
// you may not use this file except in compliance with the License. You may obtain a copy of the
51
// License at http://www.mozilla.org/MPL/
52
//
53
// Software distributed under the License is distributed on an "AS IS" basis,
54
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
55
// See the License for the specific language governing rights and limitations under the License.
56
//
57
// The Original Code is: all this file.
58
//
59
// The Initial Developer of the Original Code is Michael H. Kay
60
//
61
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
62
//
63
// Contributor(s): none
64
//
Popular Tags