1 package net.sf.saxon.instruct; 2 import net.sf.saxon.expr.XPathContext; 3 import net.sf.saxon.expr.XPathContextMajor; 4 import net.sf.saxon.style.StandardNames; 5 import net.sf.saxon.trace.InstructionInfo; 6 import net.sf.saxon.trace.InstructionInfoProvider; 7 import net.sf.saxon.trans.XPathException; 8 9 12 13 15 public class AttributeSet extends Procedure implements InstructionInfoProvider { 16 17 int nameCode; 18 19 private AttributeSet[] useAttributeSets; 20 21 public AttributeSet() {} 22 23 public void setNameCode(int nameCode) { 24 this.nameCode = nameCode; 25 } 26 27 public int getNameCode() { 28 return nameCode; 29 } 30 31 public void setUseAttributeSets(AttributeSet[] useAttributeSets) { 32 this.useAttributeSets = useAttributeSets; 33 } 34 35 public void setStackFrameMap(SlotManager stackFrameMap) { 36 if (stackFrameMap != null && stackFrameMap.getNumberOfVariables() > 0) { 37 super.setStackFrameMap(stackFrameMap); 38 } 39 } 40 41 public void expand(XPathContext context) throws XPathException { 42 44 if (useAttributeSets != null) { 45 AttributeSet.expand(useAttributeSets, context); 46 } 47 48 if (getStackFrameMap() != null) { 49 XPathContextMajor c2 = context.newContext(); 50 c2.setOrigin(this); 51 c2.openStackFrame(getStackFrameMap()); 52 getBody().process(c2); 53 } else { 54 getBody().process(context); 55 } 56 } 57 58 62 63 public InstructionInfo getInstructionInfo() { 64 InstructionDetails details = new InstructionDetails(); 65 details.setConstructType(StandardNames.XSL_ATTRIBUTE_SET); 66 details.setSystemId(getSystemId()); 67 details.setLineNumber(getLineNumber()); 68 details.setProperty("attribute-set", this); 69 return details; 70 } 71 72 78 79 protected static void expand(AttributeSet[] asets, XPathContext context) throws XPathException { 80 for (int i=0; i<asets.length; i++) { 81 asets[i].expand(context); 82 } 83 } 84 } 85 86 | Popular Tags |