19f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/*
29f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one
39f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or more contributor license agreements. See the NOTICE file
49f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed with this work for additional information
59f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * regarding copyright ownership. The ASF licenses this file
69f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to you under the Apache License, Version 2.0 (the  "License");
79f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * you may not use this file except in compliance with the License.
89f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * You may obtain a copy of the License at
99f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *
109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *     http://www.apache.org/licenses/LICENSE-2.0
119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *
129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Unless required by applicable law or agreed to in writing, software
139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS,
149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * See the License for the specific language governing permissions and
169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * limitations under the License.
179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/*
199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * $Id: ElemPI.java 468643 2006-10-28 06:56:03Z minchau $
209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpackage org.apache.xalan.templates;
229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport javax.xml.transform.TransformerException;
249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xalan.res.XSLTErrorResources;
269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xalan.transformer.TransformerImpl;
279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xml.utils.XML11Char;
289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xpath.XPathContext;
299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/**
319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Implement xsl:processing-instruction.
329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <pre>
339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <!ELEMENT xsl:processing-instruction %char-template;>
349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * <!ATTLIST xsl:processing-instruction
359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *   name %avt; #REQUIRED
369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson *   %space-att;
379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * >
389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * </pre>
399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @see <a href="http://www.w3.org/TR/xslt#section-Creating-Processing-Instructions">section-Creating-Processing-Instructions in XSLT Specification</a>
409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @xsl.usage advanced
419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */
429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpublic class ElemPI extends ElemTemplateElement
439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson{
449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    static final long serialVersionUID = 5621976448020889825L;
459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The xsl:processing-instruction element has a required name
489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * attribute that specifies the name of the processing instruction node.
499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The value of the name attribute is interpreted as an
509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * attribute value template.
519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @serial
529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  private AVT m_name_atv = null;
549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Set the "name" attribute.
579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * DJD
589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param v Value for the name attribute
609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void setName(AVT v)
629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    m_name_atv = v;
649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get the "name" attribute.
689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * DJD
699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return The value of the "name" attribute
719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public AVT getName()
739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    return m_name_atv;
759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * This function is called after everything else has been
799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * recomposed, and allows the template to set remaining
809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * values that may be based on some other property that
819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * depends on recomposition.
829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void compose(StylesheetRoot sroot) throws TransformerException
849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    super.compose(sroot);
869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    java.util.Vector vnames = sroot.getComposeState().getVariableNames();
879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    if(null != m_name_atv)
889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      m_name_atv.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize());
899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Get an int constant identifying the type of element.
959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see org.apache.xalan.templates.Constants
969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return The token ID for the element
989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public int getXSLToken()
1009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
1019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    return Constants.ELEMNAME_PI;
1029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
1039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Return the node name.
1069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return The element's name
1089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public String getNodeName()
1109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
1119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    return Constants.ELEMNAME_PI_STRING;
1129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
1139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Create a processing instruction in the result tree.
1169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * The content of the xsl:processing-instruction element is a
1179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * template for the string-value of the processing instruction node.
1189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @see <a href="http://www.w3.org/TR/xslt#section-Creating-Processing-Instructions">section-Creating-Processing-Instructions in XSLT Specification</a>
1199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param transformer non-null reference to the the current transform-time state.
1219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws TransformerException
1239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public void execute(
1259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson          TransformerImpl transformer)
1269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            throws TransformerException
1279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
1289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    XPathContext xctxt = transformer.getXPathContext();
1309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    int sourceNode = xctxt.getCurrentNode();
1319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    String piName = m_name_atv == null ? null : m_name_atv.evaluate(xctxt, sourceNode, this);
1339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // Ignore processing instruction if name is null
1359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    if (piName == null) return;
1369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    if (piName.equalsIgnoreCase("xml"))
1389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
1399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     	transformer.getMsgMgr().warn(
1409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
1419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson              new Object[]{ Constants.ATTRNAME_NAME, piName });
1429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson		return;
1439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
1449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // Only check if an avt was used (ie. this wasn't checked at compose time.)
1469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // Ignore processing instruction, if invalid
1479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    else if ((!m_name_atv.isSimple()) && (!XML11Char.isXML11ValidNCName(piName)))
1489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
1499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson     	transformer.getMsgMgr().warn(
1509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson        this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
1519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson              new Object[]{ Constants.ATTRNAME_NAME, piName });
1529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson		return;
1539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
1549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // Note the content model is:
1569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // <!ENTITY % instructions "
1579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // %char-instructions;
1589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // | xsl:processing-instruction
1599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // | xsl:comment
1609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // | xsl:element
1619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // | xsl:attribute
1629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // ">
1639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    String data = transformer.transformToString(this);
1649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    try
1669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
1679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      transformer.getResultTreeHandler().processingInstruction(piName, data);
1689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
1699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    catch(org.xml.sax.SAXException se)
1709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
1719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      throw new TransformerException(se);
1729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
1739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
1749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  /**
1769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * Add a child to the child list.
1779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @param newChild Child to add to child list
1799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @return The child just added to the child list
1819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   *
1829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   * @throws DOMException
1839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson   */
1849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
1859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  {
1869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    int type = ((ElemTemplateElement) newChild).getXSLToken();
1889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    switch (type)
1909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    {
1919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
1929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    // char-instructions
1939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_TEXTLITERALRESULT :
1949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_APPLY_TEMPLATES :
1959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_APPLY_IMPORTS :
1969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_CALLTEMPLATE :
1979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_FOREACH :
1989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_VALUEOF :
1999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_COPY_OF :
2009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_NUMBER :
2019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_CHOOSE :
2029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_IF :
2039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_TEXT :
2049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_COPY :
2059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_VARIABLE :
2069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    case Constants.ELEMNAME_MESSAGE :
2079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      // instructions
2099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      // case Constants.ELEMNAME_PI:
2109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      // case Constants.ELEMNAME_COMMENT:
2119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      // case Constants.ELEMNAME_ELEMENT:
2129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      // case Constants.ELEMNAME_ATTRIBUTE:
2139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      break;
2149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    default :
2159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson      error(XSLTErrorResources.ER_CANNOT_ADD,
2169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson            new Object[]{ newChild.getNodeName(),
2179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson                          this.getNodeName() });  //"Can not add " +((ElemTemplateElement)newChild).m_elemName +
2189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    //" to " + this.m_elemName);
2209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    }
2219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson
2229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson    return super.appendChild(newChild);
2239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson  }
2249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson}
225