001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements. See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership. The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the  "License");
007     * you may not use this file except in compliance with the License.
008     * You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    /*
019     * $Id: Constants.java 468643 2006-10-28 06:56:03Z minchau $
020     */
021    package org.apache.xalan.templates;
022    
023    
024    /**
025     * Primary constants used in the TransformerImpl classes.
026     * @xsl.usage advanced
027     */
028    public class Constants extends org.apache.xml.utils.Constants
029    {
030    
031      /**
032       * IDs for XSL element types. These are associated
033       * with the string literals in the TransformerImpl class.
034       * Don't change the numbers. NOTE THAT THESE ARE NOT IN
035       * ALPHABETICAL ORDER!
036       * (It's a pity Java doesn't have a real Enumerated Mnemonic
037       * datatype... or a C-like preprocessor in lieu thereof which
038       * could be used to generate and maintain synch between these lists.)
039       */
040      public static final int ELEMNAME_UNDEFINED = -1, ELEMNAME_WITHPARAM = 2,
041                              ELEMNAME_ADDATTRIBUTE = 4, ELEMNAME_ANCHOR = 22,
042    
043      //  ELEMNAME_ANCHOR_PATTERN = 23,
044      ELEMNAME_APPLY_TEMPLATES = 50, ELEMNAME_USE = 34, ELEMNAME_CHILDREN = 6,
045                                     ELEMNAME_CHOOSE = 37, ELEMNAME_COMMENT = 59,  // my own
046                                     ELEMNAME_CONSTRUCT = 7,  // my own
047                                     ELEMNAME_CONTENTS = 8, ELEMNAME_COPY = 9,
048                                     ELEMNAME_COPY_OF = 74,
049                                     ELEMNAME_DECIMALFORMAT = 83,
050                                     ELEMNAME_DEFINEATTRIBUTESET = 40,
051    
052      //  ELEMNAME_DEFINECONSTANT = 29,
053      //  ELEMNAME_DEFINEMACRO = 10,
054      ELEMNAME_DEFINESCRIPT = 11, ELEMNAME_DISPLAYIF = 12,  // my own
055                                  ELEMNAME_EMPTY = 14, ELEMNAME_EVAL = 15,
056                                  ELEMNAME_EXPECTEDCHILDREN = 16,
057                                  ELEMNAME_EXTENSION = 54,
058                                  ELEMNAME_EXTENSIONHANDLER = 63,
059                                  ELEMNAME_FOREACH = 28, ELEMNAME_KEY = 31,
060                                  ELEMNAME_IF = 36, ELEMNAME_IMPORT = 26,
061                                  ELEMNAME_INCLUDE = 27,
062                                  ELEMNAME_CALLTEMPLATE = 17,
063                                  ELEMNAME_PARAMVARIABLE = 41,
064                                  ELEMNAME_NUMBER = 35, ELEMNAME_NSALIAS = 84,
065                                  ELEMNAME_OTHERWISE = 39, ELEMNAME_PI = 58,
066                                  ELEMNAME_PRESERVESPACE = 33,
067                                  ELEMNAME_REMOVEATTRIBUTE = 5,
068                                  ELEMNAME_TEMPLATE = 19, ELEMNAME_SORT = 64,
069                                  ELEMNAME_STRIPSPACE = 32,
070                                  ELEMNAME_STYLESHEET = 25, ELEMNAME_TEXT = 42,
071                                  ELEMNAME_VALUEOF = 30, ELEMNAME_WHEN = 38,
072    
073      // Pattern by example support  
074      ELEMNAME_ROOT = 44, ELEMNAME_ANY = 45, ELEMNAME_ELEMENT = 46,
075                          ELEMNAME_TARGETELEMENT = 47, ELEMNAME_ATTRIBUTE = 48,
076                          ELEMNAME_TARGETATTRIBUTE = 49, ELEMNAME_URL = 52,  // my own
077                          ELEMNAME_CALL = 55,  // my own
078    
079      //  ELEMNAME_WITHPARAM = 56,
080      ELEMNAME_FALLBACK = 57,  // my own
081      ELEMNAME_TARGETPI = 60,  // my own
082      ELEMNAME_TARGETCOMMENT = 61,  // my own
083      ELEMNAME_TARGETTEXT = 62,  // my own
084      ELEMNAME_CSSSTYLECONVERSION = 65,  // my own
085      ELEMNAME_COUNTER = 66, ELEMNAME_COUNTERS = 67,
086      ELEMNAME_COUNTERINCREMENT = 68, ELEMNAME_COUNTERRESET = 69,
087      ELEMNAME_COUNTERSCOPE = 71, ELEMNAME_APPLY_IMPORTS = 72,
088      ELEMNAME_VARIABLE = 73, ELEMNAME_MESSAGE = 75, ELEMNAME_LOCALE = 76,
089      ELEMNAME_LITERALRESULT = 77, ELEMNAME_TEXTLITERALRESULT = 78,
090      ELEMNAME_EXTENSIONCALL = 79, ELEMNAME_EXTENSIONDECL = 85,
091      ELEMNAME_EXTENSIONSCRIPT = 86, ELEMNAME_OUTPUT = 80,
092      ELEMNAME_COMPONENT = 81, ELEMNAME_SCRIPT = 82;
093    
094      // Next free number: 90 (88 and 89 used for EXSLT elements);
095    
096      /**
097       * Literals for XSL element names.  Note that there are more
098       * names than IDs, because some names map to the same ID.
099       */
100      public static final String       
101              ELEMNAME_ANCHOR_STRING = "anchor",
102          ELEMNAME_ANY_STRING = "any",  // pattern-by-example support
103          ELEMNAME_APPLY_IMPORTS_STRING = "apply-imports",
104          ELEMNAME_APPLY_TEMPLATES_STRING = "apply-templates",
105          ELEMNAME_ARG_STRING = "arg",
106          ELEMNAME_ATTRIBUTESET_STRING = "attribute-set",
107          ELEMNAME_ATTRIBUTE_STRING = "attribute",  // pattern-by-example support
108          ELEMNAME_CALLTEMPLATEARG_STRING = "invoke-arg",
109          ELEMNAME_CALLTEMPLATE_STRING = "call-template",
110          ELEMNAME_CALL_STRING = "call",
111          ELEMNAME_CHILDREN_STRING = "children",
112          ELEMNAME_CHOOSE_STRING = "choose",
113          ELEMNAME_COMMENT_STRING = "comment",
114          ELEMNAME_COMPONENT_STRING = "component",
115          ELEMNAME_CONSTRUCT_STRING = "construct",  // my own
116          ELEMNAME_CONTENTS_STRING = "contents", 
117          ELEMNAME_COPY_OF_STRING ="copy-of",
118          ELEMNAME_COPY_STRING = "copy",
119          ELEMNAME_COUNTERINCREMENT_STRING = "counter-increment",
120          ELEMNAME_COUNTERRESET_STRING = "counter-reset",
121          ELEMNAME_COUNTERSCOPE_STRING = "counter-scope",
122          ELEMNAME_COUNTERS_STRING = "counters",
123          ELEMNAME_COUNTER_STRING = "counter",
124          ELEMNAME_CSSSTYLECONVERSION_STRING = "css-style-conversion",
125          ELEMNAME_DECIMALFORMAT_STRING = "decimal-format",
126          ELEMNAME_DISPLAYIF_STRING = "display-if",  // my own
127          ELEMNAME_ELEMENT_STRING = "element",  // pattern-by-example support
128          ELEMNAME_EMPTY_STRING = "empty",
129          ELEMNAME_EVAL_STRING = "eval",
130          ELEMNAME_EXPECTEDCHILDREN_STRING = "expectedchildren",
131          ELEMNAME_EXTENSIONHANDLER_STRING = "code-dispatcher",
132          ELEMNAME_EXTENSION_STRING = "functions",
133          ELEMNAME_FALLBACK_STRING = "fallback",
134          ELEMNAME_FOREACH_STRING = "for-each",
135          ELEMNAME_IF_STRING = "if",
136          ELEMNAME_IMPORT_STRING = "import",
137          ELEMNAME_INCLUDE_STRING = "include",
138          ELEMNAME_KEY_STRING = "key",
139          ELEMNAME_LOCALE_STRING = "locale",
140          ELEMNAME_MESSAGE_STRING = "message",
141          ELEMNAME_NSALIAS_STRING = "namespace-alias",
142          ELEMNAME_NUMBER_STRING = "number",
143          ELEMNAME_OTHERWISE_STRING = "otherwise",
144          ELEMNAME_OUTPUT_STRING = "output",
145          ELEMNAME_PARAMVARIABLE_STRING = "param",
146          ELEMNAME_PI_OLD_STRING = "pi",
147          ELEMNAME_PI_STRING = "processing-instruction",
148          ELEMNAME_PRESERVESPACE_STRING = "preserve-space",
149          ELEMNAME_ROOT_STRING = "root",  // pattern-by-example support
150          ELEMNAME_SCRIPT_STRING = "script",
151          ELEMNAME_SORT_STRING = "sort",
152          ELEMNAME_STRIPSPACE_STRING = "strip-space",
153          ELEMNAME_STYLESHEET_STRING = "stylesheet",
154          ELEMNAME_TARGETATTRIBUTE_STRING = "target-attribute",  // pattern-by-example support
155          ELEMNAME_TARGETCOMMENT_STRING = "target-comment",
156          ELEMNAME_TARGETELEMENT_STRING = "target-element",  // pattern-by-example support
157          ELEMNAME_TARGETPI_STRING = "target-pi",
158          ELEMNAME_TARGETTEXT_STRING = "target-text",
159          ELEMNAME_TEMPLATE_STRING = "template",
160          ELEMNAME_TEXT_STRING = "text",
161          ELEMNAME_TRANSFORM_STRING = "transform",
162          ELEMNAME_URL_STRING = "uri",  // pattern-by-example support
163          ELEMNAME_USE_STRING = "use",
164          ELEMNAME_VALUEOF_STRING = "value-of",
165          ELEMNAME_VARIABLE_STRING = "variable",
166          ELEMNAME_WHEN_STRING = "when",
167          ELEMNAME_WITHPARAM_STRING = "with-param";
168      
169      /**
170       * Literals for EXSLT function elements.
171       */
172      public static final String
173        EXSLT_ELEMNAME_FUNCTION_STRING = "function",
174        EXSLT_ELEMNAME_FUNCRESULT_STRING = "result";
175      public static final int
176        EXSLT_ELEMNAME_FUNCTION = 88,
177        EXSLT_ELEMNAME_FUNCRESULT = 89;
178      
179      
180      /**
181       * Literals for XSL attribute names.  Note that there may be more
182       * names than IDs, because some names may map to the same ID.
183       */
184      public static final String
185              ATTRNAME_AMOUNT = "amount",
186          ATTRNAME_ANCESTOR = "ancestor",
187          ATTRNAME_ARCHIVE = "archive",
188          ATTRNAME_ATTRIBUTE = "attribute",
189          ATTRNAME_ATTRIBUTE_SET = "attribute-set",
190          ATTRNAME_CASEORDER = "case-order",
191          ATTRNAME_CLASS = "class",
192          ATTRNAME_CLASSID = "classid",
193          ATTRNAME_CODEBASE = "codebase",
194          ATTRNAME_CODETYPE = "type",
195          ATTRNAME_CONDITION = "condition",
196          ATTRNAME_COPYTYPE = "copy-type",
197          ATTRNAME_COUNT = "count",
198          ATTRNAME_DATATYPE = "data-type",
199          ATTRNAME_DECIMALSEPARATOR = "decimal-separator",
200          ATTRNAME_DEFAULT = "default",
201          ATTRNAME_DEFAULTSPACE = "default-space",
202          ATTRNAME_DEPTH = "with-children",
203          ATTRNAME_DIGIT = "digit",
204          ATTRNAME_DIGITGROUPSEP = "digit-group-sep",
205          ATTRNAME_DISABLE_OUTPUT_ESCAPING = "disable-output-escaping",
206          ATTRNAME_ELEMENT = "element",
207          ATTRNAME_ELEMENTS = "elements",
208          ATTRNAME_EXCLUDE_RESULT_PREFIXES ="exclude-result-prefixes",
209          ATTRNAME_EXPR = "expr",
210          ATTRNAME_EXTENSIONELEMENTPREFIXES = "extension-element-prefixes",
211          ATTRNAME_FORMAT = "format",
212          ATTRNAME_FROM = "from",
213          ATTRNAME_GROUPINGSEPARATOR = "grouping-separator",
214          ATTRNAME_GROUPINGSIZE = "grouping-size",
215          ATTRNAME_HREF = "href",
216          ATTRNAME_ID = "id",
217          ATTRNAME_IMPORTANCE = "importance",
218          ATTRNAME_INDENTRESULT = "indent-result",
219          ATTRNAME_INFINITY = "infinity",
220          ATTRNAME_LANG = "lang",
221          ATTRNAME_LETTERVALUE = "letter-value",
222          ATTRNAME_LEVEL = "level",
223          ATTRNAME_MATCH = "match",
224          ATTRNAME_METHOD = "calls",
225          ATTRNAME_MINUSSIGN = "minus-sign",
226          ATTRNAME_MODE = "mode",
227          ATTRNAME_NAME = "name",
228          ATTRNAME_NAMESPACE = "namespace",
229          ATTRNAME_NAN = "NaN",
230          ATTRNAME_NDIGITSPERGROUP = "n-digits-per-group",
231          ATTRNAME_NS = "ns",
232          ATTRNAME_ONLY = "only",
233          ATTRNAME_ORDER = "order",
234          ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = "cdata-section-elements",
235          ATTRNAME_OUTPUT_DOCTYPE_PUBLIC = "doctype-public",
236          ATTRNAME_OUTPUT_DOCTYPE_SYSTEM = "doctype-system",
237          ATTRNAME_OUTPUT_ENCODING = "encoding",
238          ATTRNAME_OUTPUT_INDENT = "indent",
239          ATTRNAME_OUTPUT_MEDIATYPE = "media-type",
240          ATTRNAME_OUTPUT_METHOD = "method",  // qname, 
241          ATTRNAME_OUTPUT_OMITXMLDECL = "omit-xml-declaration",
242          ATTRNAME_OUTPUT_STANDALONE = "standalone",
243          ATTRNAME_OUTPUT_VERSION = "version",
244          ATTRNAME_PATTERNSEPARATOR = "pattern-separator",
245          ATTRNAME_PERCENT = "percent",
246          ATTRNAME_PERMILLE = "per-mille",
247          ATTRNAME_PRIORITY = "priority",
248          ATTRNAME_REFID = "refID",
249          ATTRNAME_RESULTNS = "result-ns",
250          ATTRNAME_RESULT_PREFIX = "result-prefix",
251          ATTRNAME_SELECT = "select",
252          ATTRNAME_SEQUENCESRC = "sequence-src",
253          ATTRNAME_STYLE = "style",
254          ATTRNAME_STYLESHEET_PREFIX = "stylesheet-prefix",
255          ATTRNAME_TERMINATE = "terminate",
256          ATTRNAME_TEST = "test",
257          ATTRNAME_TOSTRING = "to-string",
258          ATTRNAME_TYPE = "type",
259          ATTRNAME_USE = "use",
260          ATTRNAME_USEATTRIBUTESETS = "use-attribute-sets",
261          ATTRNAME_VALUE = "value",
262          ATTRNAME_VERSION = "version",
263          ATTRNAME_XMLNS = "xmlns:", // namespace declaration prefix -- NOT an attribute by itself
264          ATTRNAME_XMLNSDEF = "xmlns", // default namespace
265          ATTRNAME_XMLSPACE = "xml:space", 
266          ATTRNAME_ZERODIGIT = "zero-digit";
267    
268      /** IDs for XSL attribute types. These are associated
269       * with the string literals in the TransformerImpl class.
270       * Don't change the numbers. NOTE THAT THESE ARE NOT IN
271       * ALPHABETICAL ORDER!
272       */
273      public static final int TATTRNAME_OUTPUT_METHOD = 1, TATTRNAME_AMOUNT = 2,
274                              TATTRNAME_ANCESTOR = 3, TATTRNAME_ARCHIVE = 4,
275                              TATTRNAME_ATTRIBUTE = 5,
276                              TATTRNAME_ATTRIBUTE_SET = 6,
277                              TATTRNAME_CASEORDER = 7, TATTRNAME_CLASS = 8,
278                              TATTRNAME_CLASSID = 9, TATTRNAME_CODEBASE = 10,
279                              TATTRNAME_CODETYPE = 11, TATTRNAME_CONDITION = 12,
280                              TATTRNAME_COPYTYPE = 13, TATTRNAME_COUNT = 14,
281                              TATTRNAME_DATATYPE = 15, TATTRNAME_DEFAULT = 16,
282                              TATTRNAME_DEFAULTSPACE = 17, TATTRNAME_DEPTH = 18,
283                              TATTRNAME_DIGITGROUPSEP = 19,
284                              TATTRNAME_DISABLE_OUTPUT_ESCAPING = 20,
285                              TATTRNAME_ELEMENT = 21, TATTRNAME_ELEMENTS = 22,
286                              TATTRNAME_EXPR = 23,
287                              TATTRNAME_EXTENSIONELEMENTPREFIXES = 24,
288                              TATTRNAME_FORMAT = 25, TATTRNAME_FROM = 26,
289                              TATTRNAME_GROUPINGSEPARATOR = 27,
290                              TATTRNAME_GROUPINGSIZE = 28, TATTRNAME_HREF = 29,
291                              TATTRNAME_ID = 30, TATTRNAME_IMPORTANCE = 31,
292                              TATTRNAME_INDENTRESULT = 32, TATTRNAME_LANG = 33,
293                              TATTRNAME_LETTERVALUE = 34, TATTRNAME_LEVEL = 35,
294                              TATTRNAME_MATCH = 36, TATTRNAME_METHOD = 37,
295                              TATTRNAME_MODE = 38, TATTRNAME_NAME = 39,
296                              TATTRNAME_NAMESPACE = 40,
297                              TATTRNAME_NDIGITSPERGROUP = 41, TATTRNAME_NS = 42,
298                              TATTRNAME_ONLY = 43, TATTRNAME_ORDER = 44,
299                              TATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = 45,
300                              TATTRNAME_OUTPUT_DOCTYPE_PUBLIC = 46,
301                              TATTRNAME_OUTPUT_DOCTYPE_SYSTEM = 47,
302                              TATTRNAME_OUTPUT_ENCODING = 48,
303                              TATTRNAME_OUTPUT_INDENT = 49,
304                              TATTRNAME_OUTPUT_MEDIATYPE = 50,
305                              TATTRNAME_OUTPUT_STANDALONE = 51,
306                              TATTRNAME_OUTPUT_VERSION = 52,
307                              TATTRNAME_OUTPUT_OMITXMLDECL = 53,
308                              TATTRNAME_PRIORITY = 54, TATTRNAME_REFID = 55,
309                              TATTRNAME_RESULTNS = 56, TATTRNAME_SELECT = 57,
310                              TATTRNAME_SEQUENCESRC = 58, TATTRNAME_STYLE = 59,
311                              TATTRNAME_TEST = 60, TATTRNAME_TOSTRING = 61,
312                              TATTRNAME_TYPE = 62, TATTRNAME_USE = 63,
313                              TATTRNAME_USEATTRIBUTESETS = 64,
314                              TATTRNAME_VALUE = 65, TATTRNAME_XMLNSDEF = 66,
315                              TATTRNAME_XMLNS = 67, TATTRNAME_XMLSPACE = 68,
316                              TATTRNAME_EXCLUDE_RESULT_PREFIXES = 69;
317    
318      /** Mnemonics for the possible values of the xsl:output element's
319       * method= attribute:
320       * <ul>
321       * <li>ATTRVAL_OUTPUT_METHOD_XML = Use an XML formatter to
322       * produce the output document (basic XSLT operation).</li>
323       * <li>ATTRVAL_OUTPUT_METHOD_HTML: Use an HTML formatter to
324       * produce the output document. When generating HTML documents,
325       * this may yield better results; it does things like escaping
326       * characters in href attributes.</li>
327       * </li>ATTRVAL_OUTPUT_METHOD_TEXT:  Use a Text formatter to
328       * produce the output document. Generally the right choice if your
329       * stylesheet wants to take over _all_ the details of formatting,
330       * most often when producing something that isn't an XML or HTML
331       * document.</li>
332       * </ul> 
333       * */
334      public static final String ATTRVAL_OUTPUT_METHOD_HTML = "html",
335                                 ATTRVAL_OUTPUT_METHOD_XML = "xml",
336                                 ATTRVAL_OUTPUT_METHOD_TEXT = "text";
337    
338      
339      /* For space-att*/
340      public static final int ATTRVAL_PRESERVE = 1, ATTRVAL_STRIP = 2;
341    
342      
343      /** For indent-result          */
344      public static final boolean ATTRVAL_YES = true, ATTRVAL_NO = false;
345    
346      
347      /** For letter-value attribute (part of conversion attributes).          */
348      public static final String ATTRVAL_ALPHABETIC = "alphabetic",
349                                 ATTRVAL_OTHER = "other",
350                                 ATTRVAL_TRADITIONAL = "traditional";
351    
352      
353      /** For level attribute in xsl:number.          */
354      public static final String ATTRVAL_SINGLE = "single",
355                                 ATTRVAL_MULTI = "multiple", ATTRVAL_ANY = "any";
356    
357      
358      /** For Stylesheet-prefix and result-prefix in xsl:namespace-alias          */
359      public static final String ATTRVAL_DEFAULT_PREFIX = "#default";
360    
361     /** Integer equivalents for above        */
362      public static final int NUMBERLETTER_ALPHABETIC = 1, NUMBERLETTER_TRADITIONAL = 2;
363      
364      /** Integer equivelents for above        */
365      public static final int NUMBERLEVEL_SINGLE = 1, NUMBERLEVEL_MULTI = 2,
366                              NUMBERLEVEL_ANY = 3, MAX_MULTI_COUNTING_DEPTH = 32;
367    
368      
369      /** some stuff for my patterns-by-example         */
370      public static final String ATTRVAL_THIS = ".", ATTRVAL_PARENT = "..",
371                                 ATTRVAL_ANCESTOR = "ancestor", ATTRVAL_ID = "id";
372    
373      
374      /** Stuff for sorting      */
375      public static final String ATTRVAL_DATATYPE_TEXT = "text",
376                                 ATTRVAL_DATATYPE_NUMBER = "number",
377                                 ATTRVAL_ORDER_ASCENDING = "ascending",
378                                 ATTRVAL_ORDER_DESCENDING = "descending",
379                                 ATTRVAL_CASEORDER_UPPER = "upper-first",
380                                 ATTRVAL_CASEORDER_LOWER = "lower-first";
381    
382     /** Integer equivelents for DATATYPE attribute */
383      public static final int SORTDATATYPE_TEXT = 1, SORTDATATYPE_NUMBER = 2;
384    
385      /** Integer equivelents for ORDER attribute */
386      public static final int SORTORDER_ASCENDING = 1, SORTORDER_DESCENDING = 2;
387      
388      /** Integer equivelents for CASE-ORDER attribute */
389      public static final int SORTCASEORDER_UPPERFIRST = 1, SORTCASEORDER_LOWERFIRST = 2;
390      
391      /** some stuff for Decimal-format       */
392      public static final String ATTRVAL_INFINITY = "Infinity",
393                                 ATTRVAL_NAN = "NaN",
394                                 DEFAULT_DECIMAL_FORMAT = "#default";
395    
396      
397      /** temp dummy         */
398      public static final String ATTRNAME_XXXX = "XXXX";
399    }