KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > style > XSLNamespaceAlias


1 package com.icl.saxon.style;
2 import com.icl.saxon.tree.AttributeCollection;
3 import com.icl.saxon.*;
4 import com.icl.saxon.expr.*;
5 import javax.xml.transform.*;
6
7 import com.icl.saxon.om.NamespaceException;
8 import java.util.*;
9
10 /**
11 * An xsl:namespace-alias element in the stylesheet.<BR>
12 */

13
14 public class XSLNamespaceAlias extends StyleElement {
15
16     private short stylesheetURICode;
17     private short resultURICode;
18
19     public void prepareAttributes() throws TransformerConfigurationException {
20
21         String JavaDoc stylesheetPrefix=null;
22         String JavaDoc resultPrefix=null;
23
24         StandardNames sn = getStandardNames();
25         AttributeCollection atts = getAttributeList();
26         
27         for (int a=0; a<atts.getLength(); a++) {
28             int nc = atts.getNameCode(a);
29             int f = nc & 0xfffff;
30             if (f==sn.STYLESHEET_PREFIX) {
31                 stylesheetPrefix = atts.getValue(a);
32             } else if (f==sn.RESULT_PREFIX) {
33                 resultPrefix = atts.getValue(a);
34             } else {
35                 checkUnknownAttribute(nc);
36             }
37         }
38         if (stylesheetPrefix==null) {
39             reportAbsence("stylesheet-prefix");
40             return;
41         }
42         if (stylesheetPrefix.equals("#default")) {
43             stylesheetPrefix="";
44         }
45         if (resultPrefix==null) {
46             reportAbsence("result-prefix");
47             return;
48         }
49         if (resultPrefix.equals("#default")) {
50             resultPrefix="";
51         }
52         try {
53             stylesheetURICode = getURICodeForPrefix(stylesheetPrefix);
54             resultURICode = getURICodeForPrefix(resultPrefix);
55         } catch (NamespaceException err) {
56             compileError(err.getMessage());
57         }
58     }
59
60     public void validate() throws TransformerConfigurationException {
61         checkTopLevel();
62     }
63
64     public void preprocess() throws TransformerConfigurationException {}
65
66     public void process(Context c) {}
67
68     public short getStylesheetURICode() {
69         return stylesheetURICode;
70     }
71
72     public short getResultURICode() {
73         return resultURICode;
74     }
75
76 }
77
78 //
79
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
80
// you may not use this file except in compliance with the License. You may obtain a copy of the
81
// License at http://www.mozilla.org/MPL/
82
//
83
// Software distributed under the License is distributed on an "AS IS" basis,
84
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
85
// See the License for the specific language governing rights and limitations under the License.
86
//
87
// The Original Code is: all this file.
88
//
89
// The Initial Developer of the Original Code is
90
// Michael Kay of International Computers Limited (mhkay@iclway.co.uk).
91
//
92
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
93
//
94
// Contributor(s): none.
95
//
96
Popular Tags