/** * Copy attributes specified by use-attribute-sets to the result tree. * Specifying a use-attribute-sets attribute is equivalent to adding * xsl:attribute elements for each of the attributes in each of the * named attribute sets to the beginning of the content of the element * with the use-attribute-sets attribute, in the same order in which * the names of the attribute sets are specified in the use-attribute-sets * attribute. It is an error if use of use-attribute-sets attributes * on xsl:attribute-set elements causes an attribute set to directly * or indirectly use itself. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (null != m_attributeSetsNames) { applyAttrSets(transformer, getStylesheetRoot(), m_attributeSetsNames); } } }
/** * Add a child to the child list. * <!ELEMENT xsl:attribute-set (xsl:attribute)*> * <!ATTLIST xsl:attribute-set * name %qname; #REQUIRED * use-attribute-sets %qnames; #IMPLIED * > * * @param newChild Child to be added to this node's list of children * * @return The child that was just added to the list of children * * @throws DOMException */ public ElemTemplateElement appendChildElem(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); switch (type) { case Constants.ELEMNAME_ATTRIBUTE : break; default : error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); } return super.appendChild(newChild); }
/** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if (callAttrs && null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); avt.callVisitors(visitor); } } super.callChildVisitors(visitor, callAttrs); }
/** * Apply a set of attributes to the element. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (transformer.isRecursiveAttrSet(this)) { throw new TransformerException( XSLMessages.createMessage( XSLTErrorResources.ER_XSLATTRSET_USED_ITSELF, new Object[]{ m_qname.getLocalPart() })); //"xsl:attribute-set '"+m_qname.m_localpart+ } transformer.pushElemAttributeSet(this); super.execute(transformer); ElemAttribute attr = (ElemAttribute) getFirstChildElem(); while (null != attr) { attr.execute(transformer); attr = (ElemAttribute) attr.getNextSiblingElem(); } transformer.popElemAttributeSet(); }
/** * Add the attributes from the named attribute sets to the attribute list. * TODO: Error handling for: "It is an error if there are two attribute sets * with the same expanded-name and with equal import precedence and that both * contain the same attribute unless there is a definition of the attribute * set with higher import precedence that also contains the attribute." * * @param transformer non-null reference to the the current transform-time state. * @param stylesheet The owning root stylesheet * * @throws TransformerException */ public void applyAttrSets( TransformerImpl transformer, StylesheetRoot stylesheet) throws TransformerException { applyAttrSets(transformer, stylesheet, m_attributeSetsNames); }
/** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); java.util.Vector vnames = cstate.getVariableNames(); if (null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); avt.fixupVariables(vnames, cstate.getGlobalsSize()); } } }
/** * Set the "xml:space" attribute. * A text node is preserved if an ancestor element of the text node * has an xml:space attribute with a value of preserve, and * no closer ancestor element has xml:space with a value of default. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a> * @see <a href="http://www.w3.org/TR/xslt#section-Creating-Text">section-Creating-Text in XSLT Specification</a> * * @param avt Enumerated value, either Constants.ATTRVAL_PRESERVE * or Constants.ATTRVAL_STRIP. */ public void setXmlSpace(AVT avt) { // This function is a bit-o-hack, I guess... addLiteralResultAttribute(avt); String val = avt.getSimpleString(); if(val.equals("default")) { super.setXmlSpace(Constants.ATTRVAL_STRIP); } else if(val.equals("preserve")) { super.setXmlSpace(Constants.ATTRVAL_PRESERVE); } // else maybe it's a real AVT, so we can't resolve it at this time. }
null == m_ExtensionElementURIs) return super.containsExcludeResultPrefix(prefix, uri); return true; return super.containsExcludeResultPrefix(prefix, uri);
/** * Add the attributes from the named attribute sets to the attribute list. * TODO: Error handling for: "It is an error if there are two attribute sets * with the same expanded-name and with equal import precedence and that both * contain the same attribute unless there is a definition of the attribute * set with higher import precedence that also contains the attribute." * * @param transformer non-null reference to the the current transform-time state. * @param stylesheet The owning root stylesheet * * @throws TransformerException */ public void applyAttrSets( TransformerImpl transformer, StylesheetRoot stylesheet) throws TransformerException { applyAttrSets(transformer, stylesheet, m_attributeSetsNames); }
/** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); java.util.Vector vnames = cstate.getVariableNames(); if (null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); avt.fixupVariables(vnames, cstate.getGlobalsSize()); } } }
/** * Set the "xml:space" attribute. * A text node is preserved if an ancestor element of the text node * has an xml:space attribute with a value of preserve, and * no closer ancestor element has xml:space with a value of default. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a> * @see <a href="http://www.w3.org/TR/xslt#section-Creating-Text">section-Creating-Text in XSLT Specification</a> * * @param avt Enumerated value, either Constants.ATTRVAL_PRESERVE * or Constants.ATTRVAL_STRIP. */ public void setXmlSpace(AVT avt) { // This function is a bit-o-hack, I guess... addLiteralResultAttribute(avt); String val = avt.getSimpleString(); if(val.equals("default")) { super.setXmlSpace(Constants.ATTRVAL_STRIP); } else if(val.equals("preserve")) { super.setXmlSpace(Constants.ATTRVAL_PRESERVE); } // else maybe it's a real AVT, so we can't resolve it at this time. }
null == m_ExtensionElementURIs) return super.containsExcludeResultPrefix(prefix, uri); return true; return super.containsExcludeResultPrefix(prefix, uri);
/** * Copy attributes specified by use-attribute-sets to the result tree. * Specifying a use-attribute-sets attribute is equivalent to adding * xsl:attribute elements for each of the attributes in each of the * named attribute sets to the beginning of the content of the element * with the use-attribute-sets attribute, in the same order in which * the names of the attribute sets are specified in the use-attribute-sets * attribute. It is an error if use of use-attribute-sets attributes * on xsl:attribute-set elements causes an attribute set to directly * or indirectly use itself. * * @param transformer non-null reference to the the current transform-time state. * * @throws TransformerException */ public void execute( TransformerImpl transformer) throws TransformerException { if (null != m_attributeSetsNames) { applyAttrSets(transformer, getStylesheetRoot(), m_attributeSetsNames); } } }
nodeName); super.execute(transformer);
/** * Add the attributes from the named attribute sets to the attribute list. * TODO: Error handling for: "It is an error if there are two attribute sets * with the same expanded-name and with equal import precedence and that both * contain the same attribute unless there is a definition of the attribute * set with higher import precedence that also contains the attribute." * * @param transformer non-null reference to the the current transform-time state. * @param stylesheet The owning root stylesheet * * @throws TransformerException */ public void applyAttrSets( TransformerImpl transformer, StylesheetRoot stylesheet) throws TransformerException { applyAttrSets(transformer, stylesheet, m_attributeSetsNames); }
/** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if (callAttrs && null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); avt.callVisitors(visitor); } } super.callChildVisitors(visitor, callAttrs); }
/** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); StylesheetRoot.ComposeState cstate = sroot.getComposeState(); java.util.Vector vnames = cstate.getVariableNames(); if(null != m_name_avt) m_name_avt.fixupVariables(vnames, cstate.getGlobalsSize()); if(null != m_namespace_avt) m_namespace_avt.fixupVariables(vnames, cstate.getGlobalsSize()); }