1 package com.icl.saxon.style; 2 import com.icl.saxon.tree.AttributeCollection; 3 import com.icl.saxon.*; 4 import com.icl.saxon.handlers.*; 5 import com.icl.saxon.expr.*; 6 7 import javax.xml.transform.*; 8 import java.io.*; 9 10 14 15 public class XSLVariable extends XSLGeneralVariable implements Binding { 16 17 private int slotNumber; 18 19 public int getSlotNumber() { 20 return slotNumber; 21 } 22 23 27 28 public boolean isInstruction() { 29 return true; 30 } 31 32 35 36 public void validate() throws TransformerConfigurationException { 37 super.validate(); 38 checkDuplicateDeclaration(); 39 if (global && !redundant) { 40 slotNumber = getPrincipalStyleSheet().allocateSlotNumber(); 41 } else { 42 Procedure p = getOwningProcedure(); 43 slotNumber = p.allocateSlotNumber(); 44 } 45 } 46 47 51 52 public int getDataType() { 53 if (assignable) { 54 return Value.ANY; 55 } 56 if (select!=null) { 57 return select.getDataType(); 58 } else { 59 return Value.NODESET; 60 } 61 } 62 63 67 68 public Value constantValue() { 69 if (assignable) { 70 return null; 71 } 72 if (select!=null && select instanceof Value) { 73 return (Value)select; 74 } else { 75 return null; 76 } 77 } 78 79 80 83 84 public void process(Context context) throws TransformerException 85 { 86 Bindery b = context.getBindery(); 87 if (global) { 88 if (!redundant && !b.isEvaluated(this)) { Value value = getSelectValue(context); 90 b.defineGlobalVariable(this, value); 91 } 92 } else { 93 Value value = getSelectValue(context); 94 b.defineLocalVariable(this, value); 95 } 96 } 97 98 } 99 100 | Popular Tags |