| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.style; |
| 9 |
|
| 10 |
import net.sf.saxon.expr.Expression; |
| 11 |
import net.sf.saxon.expr.instruct.OnEmptyExpr; |
| 12 |
import net.sf.saxon.om.AxisInfo; |
| 13 |
import net.sf.saxon.trans.XPathException; |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
public final class XSLOnEmpty extends XSLSequence { |
| 21 |
|
| 22 |
@Override |
| 23 |
public void validate(ComponentDeclaration decl) throws XPathException { |
| 24 |
super.validate(decl); |
| 25 |
iterateAxis(AxisInfo.FOLLOWING_SIBLING).forEachOrFail(next -> { |
| 26 |
if (!(next instanceof XSLFallback || next instanceof XSLCatch)) { |
| 27 |
compileError("xsl:on-empty must be the last instruction in the sequence constructor"); |
| 28 |
} |
| 29 |
}); |
| 30 |
} |
| 31 |
|
| 32 |
@Override |
| 33 |
public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException { |
| 34 |
Expression e = super.compile(exec, decl); |
| 35 |
return new OnEmptyExpr(e); |
| 36 |
} |
| 37 |
} |