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 XslCallTemplate extends XslNode { 39 private String _name; 40 41 44 public void addAttribute(QName name, String value) 45 throws XslParseException 46 { 47 if (name.getName().equals("name")) 48 _name = value; 49 else 50 super.addAttribute(name, value); 51 } 52 53 56 public void endAttributes() 57 throws XslParseException 58 { 59 if (_name == null) 60 throw error(L.l("xsl:call-template needs a 'name' attribute.")); 61 } 62 63 68 public void generate(JavaWriter out) 69 throws Exception 70 { 71 if (! _gen.hasMacro(_name)) 72 throw error(L.l("'{0}' is an unknown template name. xsl:call-template name must match a defined xsl:template name.", 73 _name)); 74 75 pushCall(out); 76 generateChildren(out); 77 out.println(_gen.getMacroName(_name) + "(out, node, _xsl_arg" + 78 _gen.getCallDepth() + ");"); 79 80 popCall(out); 81 } 82 83 protected void popScope(JavaWriter out) 84 throws Exception 85 { 86 } 87 } 88 | Popular Tags |