1 28 29 package com.caucho.xsl.java; 30 31 import com.caucho.java.JavaWriter; 32 import com.caucho.xml.QName; 33 import com.caucho.xsl.XslParseException; 34 35 38 public class XtpExpression extends XslNode { 39 private String _text = ""; 40 41 44 public String getTagName() 45 { 46 return "xtp:expression"; 47 } 48 49 52 public void addAttribute(QName name, String value) 53 throws XslParseException 54 { 55 if (name.getName().equals("expr")) 56 _text = value; 57 else 58 super.addAttribute(name, value); 59 } 60 61 64 public void addChild(XslNode node) 65 throws XslParseException 66 { 67 if (node == null) 68 return; 69 70 if (node instanceof TextNode) { 71 _text += ((TextNode) node).getText(); 72 } 73 else 74 throw error(L.l("'{0}' is not allowed as an xtp:expression child.", 75 node)); 76 } 77 78 83 public void generate(JavaWriter out) 84 throws Exception 85 { 86 out.println("out.print(" + _text + ");"); 87 } 88 } 89 | Popular Tags |