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.Executable; 5 import net.sf.saxon.instruct.NextMatch; 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 XSLNextMatch extends StyleElement { 16 17 18 22 23 public boolean isInstruction() { 24 return true; 25 } 26 27 31 32 public boolean mayContainFallback() { 33 return true; 34 } 35 36 public void prepareAttributes() throws XPathException { 37 38 AttributeCollection atts = getAttributeList(); 39 40 for (int a=0; a<atts.getLength(); a++) { 41 int nc = atts.getNameCode(a); 42 checkUnknownAttribute(nc); 43 } 44 } 45 46 public void validate() throws XPathException { 47 checkWithinTemplate(); 48 AxisIterator kids = iterateAxis(Axis.CHILD); 49 while (true) { 50 NodeInfo child = (NodeInfo)kids.next(); 51 if (child == null) { 52 break; 53 } 54 if (child instanceof XSLWithParam || child instanceof XSLFallback) { 55 } else if (child.getNodeKind() == Type.TEXT) { 57 if (!Whitespace.isWhite(child.getStringValueCS())) { 59 compileError("No character data is allowed within xsl:next-match", "XTSE0010"); 60 } 61 } else { 62 compileError("Child element " + child.getDisplayName() + 63 " is not allowed within xsl:next-match", "XTSE0010"); 64 } 65 } 66 67 } 68 69 public Expression compile(Executable exec) throws XPathException { 70 NextMatch inst = new NextMatch(backwardsCompatibleModeIsEnabled()); 71 inst.setActualParameters(getWithParamInstructions(exec, false, inst), 72 getWithParamInstructions(exec, true, inst)); 73 ExpressionTool.makeParentReferences(inst); 74 return inst; 75 } 76 77 } 78 79 | Popular Tags |