1 package net.sf.saxon.style; 2 import net.sf.saxon.expr.Expression; 3 import net.sf.saxon.expr.ExpressionTool; 4 import net.sf.saxon.instruct.ApplyImports; 5 import net.sf.saxon.instruct.Executable; 6 import net.sf.saxon.om.*; 7 import net.sf.saxon.trans.XPathException; 8 import net.sf.saxon.type.Type; 9 import net.sf.saxon.value.Whitespace; 10 11 14 15 public class XSLApplyImports extends StyleElement { 16 17 18 22 23 public boolean isInstruction() { 24 return true; 25 } 26 27 public void prepareAttributes() throws XPathException { 28 29 AttributeCollection atts = getAttributeList(); 30 31 for (int a=0; a<atts.getLength(); a++) { 32 int nc = atts.getNameCode(a); 33 checkUnknownAttribute(nc); 34 } 35 } 36 37 public void validate() throws XPathException { 38 checkWithinTemplate(); 39 AxisIterator kids = iterateAxis(Axis.CHILD); 40 while (true) { 41 NodeInfo child = (NodeInfo)kids.next(); 42 if (child == null) { 43 break; 44 } 45 if (child instanceof XSLWithParam) { 46 } else if (child.getNodeKind() == Type.TEXT) { 48 if (!Whitespace.isWhite(child.getStringValueCS())) { 50 compileError("No character data is allowed within xsl:apply-imports", "XTSE0010"); 51 } 52 } else { 53 compileError("Child element " + child.getDisplayName() + 54 " is not allowed within xsl:apply-imports", "XTSE0010"); 55 } 56 } 57 } 58 59 public Expression compile(Executable exec) throws XPathException { 60 ApplyImports inst = new ApplyImports(backwardsCompatibleModeIsEnabled()); 61 inst.setActualParameters(getWithParamInstructions(exec, false, inst), 62 getWithParamInstructions(exec, true, inst)); 63 ExpressionTool.makeParentReferences(inst); 64 return inst; 65 } 66 67 } 68 69 | Popular Tags |