| 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.StringLiteral; |
| 12 |
import net.sf.saxon.expr.instruct.Comment; |
| 13 |
import net.sf.saxon.om.AttributeCollection; |
| 14 |
import net.sf.saxon.trans.XPathException; |
| 15 |
import net.sf.saxon.value.StringValue; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
public final class XSLComment extends XSLLeafNodeConstructor { |
| 22 |
|
| 23 |
public void prepareAttributes() throws XPathException { |
| 24 |
|
| 25 |
String selectAtt = null; |
| 26 |
|
| 27 |
AttributeCollection atts = getAttributeList(); |
| 28 |
for (int a = 0; a < atts.getLength(); a++) { |
| 29 |
String f = atts.getQName(a); |
| 30 |
if (f.equals("select")) { |
| 31 |
selectAtt = atts.getValue(a); |
| 32 |
select = makeExpression(selectAtt, a); |
| 33 |
} else { |
| 34 |
checkUnknownAttribute(atts.getNodeName(a)); |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
} |
| 39 |
|
| 40 |
public void validate(ComponentDeclaration decl) throws XPathException { |
| 41 |
select = typeCheck("select", select); |
| 42 |
super.validate(decl); |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
protected String getErrorCodeForSelectPlusContent() { |
| 52 |
return "XTSE0940"; |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException { |
| 57 |
Comment inst = new Comment(); |
| 58 |
compileContent(exec, decl, inst, new StringLiteral(StringValue.SINGLE_SPACE)); |
| 59 |
return inst; |
| 60 |
} |
| 61 |
|
| 62 |
} |