| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.style; |
| 9 |
|
| 10 |
import net.sf.saxon.om.AxisInfo; |
| 11 |
import net.sf.saxon.trans.XPathException; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
public abstract class XSLModuleRoot extends StyleElement { |
| 17 |
|
| 18 |
public static final int ANNOTATION_UNSPECIFIED = 0; |
| 19 |
public static final int ANNOTATION_STRIP = 1; |
| 20 |
public static final int ANNOTATION_PRESERVE = 2; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
public boolean isDeclaredModes() { |
| 29 |
return false; |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public void processAllAttributes() throws XPathException { |
| 37 |
prepareAttributes(); |
| 38 |
iterateAxis(AxisInfo.CHILD).forEach(node -> { |
| 39 |
if (node instanceof StyleElement) { |
| 40 |
try { |
| 41 |
((StyleElement) node).processAllAttributes(); |
| 42 |
} catch (XPathException err) { |
| 43 |
((StyleElement) node).compileError(err); |
| 44 |
} |
| 45 |
} |
| 46 |
}); |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
@Override |
| 51 |
public void index(ComponentDeclaration decl, PrincipalStylesheetModule top) { |
| 52 |
compileError(getDisplayName() + " can appear only as the outermost element", "XTSE0010"); |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
public int getInputTypeAnnotationsAttribute() { |
| 64 |
String inputTypeAnnotationsAtt = getAttributeValue("", "input-type-annotations"); |
| 65 |
if (inputTypeAnnotationsAtt != null) { |
| 66 |
switch (inputTypeAnnotationsAtt) { |
| 67 |
case "strip": |
| 68 |
return ANNOTATION_STRIP; |
| 69 |
case "preserve": |
| 70 |
return ANNOTATION_PRESERVE; |
| 71 |
case "unspecified": |
| 72 |
return ANNOTATION_UNSPECIFIED; |
| 73 |
default: |
| 74 |
compileError("Invalid value for input-type-annotations attribute. " + |
| 75 |
"Permitted values are (strip, preserve, unspecified)", "XTSE0020"); |
| 76 |
return ANNOTATION_UNSPECIFIED; |
| 77 |
} |
| 78 |
} |
| 79 |
return -1; |
| 80 |
} |
| 81 |
|
| 82 |
} |
| 83 |
|