1 16 19 package org.apache.xalan.templates; 20 21 import javax.xml.transform.TransformerException ; 22 23 import org.apache.xalan.res.XSLMessages; 24 import org.apache.xalan.res.XSLTErrorResources; 25 import org.apache.xalan.transformer.TransformerImpl; 26 import org.apache.xml.utils.QName; 27 28 40 public class ElemAttributeSet extends ElemUse 41 { 42 43 47 public QName m_qname = null; 48 49 55 public void setName(QName name) 56 { 57 m_qname = name; 58 } 59 60 66 public QName getName() 67 { 68 return m_qname; 69 } 70 71 77 public int getXSLToken() 78 { 79 return Constants.ELEMNAME_DEFINEATTRIBUTESET; 80 } 81 82 87 public String getNodeName() 88 { 89 return Constants.ELEMNAME_ATTRIBUTESET_STRING; 90 } 91 92 101 public void execute( 102 TransformerImpl transformer) 103 throws TransformerException 104 { 105 106 if (TransformerImpl.S_DEBUG) 107 transformer.getTraceManager().fireTraceEvent(this); 108 109 if (transformer.isRecursiveAttrSet(this)) 110 { 111 throw new TransformerException ( 112 XSLMessages.createMessage( 113 XSLTErrorResources.ER_XSLATTRSET_USED_ITSELF, 114 new Object []{ m_qname.getLocalPart() })); } 116 117 transformer.pushElemAttributeSet(this); 118 super.execute(transformer); 119 120 ElemAttribute attr = (ElemAttribute) getFirstChildElem(); 121 122 while (null != attr) 123 { 124 attr.execute(transformer); 125 126 attr = (ElemAttribute) attr.getNextSiblingElem(); 127 } 128 129 transformer.popElemAttributeSet(); 130 131 if (TransformerImpl.S_DEBUG) 132 transformer.getTraceManager().fireTraceEndEvent(this); 133 134 } 135 136 150 public ElemTemplateElement appendChildElem(ElemTemplateElement newChild) 151 { 152 153 int type = ((ElemTemplateElement) newChild).getXSLToken(); 154 155 switch (type) 156 { 157 case Constants.ELEMNAME_ATTRIBUTE : 158 break; 159 default : 160 error(XSLTErrorResources.ER_CANNOT_ADD, 161 new Object []{ newChild.getNodeName(), 162 this.getNodeName() }); 164 } 166 167 return super.appendChild(newChild); 168 } 169 170 175 public void recompose(StylesheetRoot root) 176 { 177 root.recomposeAttributeSets(this); 178 } 179 180 } 181 | Popular Tags |