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 import java.util.ArrayList ; 36 37 40 public class XslAttributeSet extends XslNode implements XslTopNode { 41 private String _name; 42 private ArrayList <XslAttribute> _attributes = new ArrayList <XslAttribute>(); 43 private ArrayList <String > _useAttributeSets = new ArrayList <String >(); 44 45 48 public String getTagName() 49 { 50 return "xsl:attribute-set"; 51 } 52 53 56 public ArrayList <XslAttribute> getAttributes() 57 { 58 ArrayList <XslAttribute> attributes = new ArrayList <XslAttribute>(); 59 60 attributes.addAll(_attributes); 61 62 for (int i = 0; i < _useAttributeSets.size(); i++) { 63 String useSet = _useAttributeSets.get(i); 64 65 attributes.addAll(_gen.getAttributeSetList(useSet)); 66 } 67 68 return attributes; 69 } 70 71 74 public void addAttribute(QName name, String value) 75 throws XslParseException 76 { 77 if (name.getName().equals("name")) 78 _name = value; 79 else if (name.getName().equals("use-attribute-sets")) { 80 _useAttributeSets.add(value); 81 } 82 else 83 super.addAttribute(name, value); 84 } 85 86 89 public void endAttributes() 90 throws XslParseException 91 { 92 if (_name == null) 93 throw error(L.l("xsl:attribute-set needs a 'name' attribute.")); 94 } 95 96 99 public void addChild(XslNode node) 100 throws XslParseException 101 { 102 if (node instanceof XslAttribute) { 103 _attributes.add((XslAttribute) node); 104 } 105 else if (node instanceof TextNode) { 106 } 107 else 108 throw error(L.l("<xsl:attribute-set> can only have <xsl:attribute> children.")); 109 } 110 111 114 public void endElement() 115 throws Exception 116 { 117 _gen.addAttributeSet(_name, this); 118 } 119 120 125 public void generate(JavaWriter out) 126 throws Exception 127 { 128 } 129 } 130 | Popular Tags |