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 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 stylesheetPrefix=null; 22 String 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 | Popular Tags |