1 package com.icl.saxon.style; 2 import com.icl.saxon.tree.AttributeCollection; 3 import com.icl.saxon.tree.NodeImpl; 4 import com.icl.saxon.*; 5 6 import com.icl.saxon.om.NodeInfo; 7 import com.icl.saxon.expr.*; 8 9 import javax.xml.transform.*; 10 import java.util.*; 11 import java.io.*; 12 13 16 17 public class XSLApplyImports extends StyleElement { 18 19 20 24 25 public boolean isInstruction() { 26 return true; 27 } 28 29 public void prepareAttributes() throws TransformerConfigurationException { 30 31 AttributeCollection atts = getAttributeList(); 32 33 String selectAtt = null; 34 35 for (int a=0; a<atts.getLength(); a++) { 36 int nc = atts.getNameCode(a); 37 checkUnknownAttribute(nc); 38 } 39 40 } 41 42 public void validate() throws TransformerConfigurationException { 43 checkWithinTemplate(); 44 } 45 46 public void process(Context context) throws TransformerException { 47 48 50 ParameterSet params = null; 51 52 if (hasChildNodes()) { 53 NodeImpl child = (NodeImpl)getFirstChild(); 54 params = new ParameterSet(); 55 while (child != null) { 56 if (child instanceof XSLWithParam) { XSLWithParam param = (XSLWithParam)child; 58 params.put(param.getVariableFingerprint(), param.getParamValue(context)); 59 } 60 child = (NodeImpl)child.getNextSibling(); 61 } 62 } 63 64 XSLTemplate currentTemplate = context.getCurrentTemplate(); 65 if (currentTemplate==null) { 66 throw new TransformerException("There is no current template"); 67 } 68 69 int min = currentTemplate.getMinImportPrecedence(); 70 int max = currentTemplate.getPrecedence()-1; 71 context.getController().applyImports( context, 72 context.getMode(), 73 min, 74 max, 75 params); 76 context.setCurrentTemplate(currentTemplate); 77 } 78 79 80 } 81 82 | Popular Tags |