14c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/*
24c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one
34c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * or more contributor license agreements. See the NOTICE file
44c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * distributed with this work for additional information
54c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * regarding copyright ownership. The ASF licenses this file
64c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * to you under the Apache License, Version 2.0 (the  "License");
74c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * you may not use this file except in compliance with the License.
84c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * You may obtain a copy of the License at
94c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *
104c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *     http://www.apache.org/licenses/LICENSE-2.0
114c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *
124c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Unless required by applicable law or agreed to in writing, software
134c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS,
144c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * See the License for the specific language governing permissions and
164c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * limitations under the License.
174c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
184c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/*
194c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * $Id: ElemPI.java 468643 2006-10-28 06:56:03Z minchau $
204c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
214c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonpackage org.apache.xalan.templates;
224c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
234c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport javax.xml.transform.TransformerException;
244c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
254c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport org.apache.xalan.res.XSLTErrorResources;
264c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport org.apache.xalan.transformer.TransformerImpl;
274c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport org.apache.xml.utils.XML11Char;
284c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport org.apache.xpath.XPathContext;
294c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
304c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/**
314c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Implement xsl:processing-instruction.
324c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <pre>
334c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <!ELEMENT xsl:processing-instruction %char-template;>
344c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <!ATTLIST xsl:processing-instruction
354c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *   name %avt; #REQUIRED
364c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson *   %space-att;
374c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * >
384c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * </pre>
394c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @see <a href="http://www.w3.org/TR/xslt#section-Creating-Processing-Instructions">section-Creating-Processing-Instructions in XSLT Specification</a>
404c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @xsl.usage advanced
414c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */
424c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonpublic class ElemPI extends ElemTemplateElement
434c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson{
444c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    static final long serialVersionUID = 5621976448020889825L;
454c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
464c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
474c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * The xsl:processing-instruction element has a required name
484c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * attribute that specifies the name of the processing instruction node.
494c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * The value of the name attribute is interpreted as an
504c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * attribute value template.
514c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @serial
524c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
534c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  private AVT m_name_atv = null;
544c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
554c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
564c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * Set the "name" attribute.
574c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * DJD
584c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
594c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param v Value for the name attribute
604c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
614c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  public void setName(AVT v)
624c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
634c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    m_name_atv = v;
644c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
654c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
664c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
674c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * Get the "name" attribute.
684c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * DJD
694c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
704c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @return The value of the "name" attribute
714c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
724c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  public AVT getName()
734c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
744c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    return m_name_atv;
754c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
764c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
774c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
784c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * This function is called after everything else has been
794c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * recomposed, and allows the template to set remaining
804c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * values that may be based on some other property that
814c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * depends on recomposition.
824c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
834c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  public void compose(StylesheetRoot sroot) throws TransformerException
844c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
854c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    super.compose(sroot);
864c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    java.util.Vector vnames = sroot.getComposeState().getVariableNames();
874c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    if(null != m_name_atv)
884c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      m_name_atv.fixupVariables(vnames, sroot.getComposeState().getGlobalsSize());
894c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
904c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
914c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
924c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
934c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
944c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * Get an int constant identifying the type of element.
954c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @see org.apache.xalan.templates.Constants
964c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
974c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @return The token ID for the element
984c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
994c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  public int getXSLToken()
1004c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
1014c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    return Constants.ELEMNAME_PI;
1024c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
1034c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1044c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
1054c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * Return the node name.
1064c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
1074c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @return The element's name
1084c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
1094c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  public String getNodeName()
1104c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
1114c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    return Constants.ELEMNAME_PI_STRING;
1124c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
1134c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1144c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
1154c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * Create a processing instruction in the result tree.
1164c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * The content of the xsl:processing-instruction element is a
1174c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * template for the string-value of the processing instruction node.
1184c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @see <a href="http://www.w3.org/TR/xslt#section-Creating-Processing-Instructions">section-Creating-Processing-Instructions in XSLT Specification</a>
1194c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
1204c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param transformer non-null reference to the the current transform-time state.
1214c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
1224c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @throws TransformerException
1234c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
1244c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  public void execute(
1254c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson          TransformerImpl transformer)
1264c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson            throws TransformerException
1274c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
1284c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1294c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    XPathContext xctxt = transformer.getXPathContext();
1304c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    int sourceNode = xctxt.getCurrentNode();
1314c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1324c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    String piName = m_name_atv == null ? null : m_name_atv.evaluate(xctxt, sourceNode, this);
1334c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1344c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // Ignore processing instruction if name is null
1354c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    if (piName == null) return;
1364c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1374c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    if (piName.equalsIgnoreCase("xml"))
1384c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    {
1394c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     	transformer.getMsgMgr().warn(
1404c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
1414c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson              new Object[]{ Constants.ATTRNAME_NAME, piName });
1424c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson		return;
1434c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    }
1444c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1454c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // Only check if an avt was used (ie. this wasn't checked at compose time.)
1464c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // Ignore processing instruction, if invalid
1474c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    else if ((!m_name_atv.isSimple()) && (!XML11Char.isXML11ValidNCName(piName)))
1484c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    {
1494c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson     	transformer.getMsgMgr().warn(
1504c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson        this, XSLTErrorResources.WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
1514c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson              new Object[]{ Constants.ATTRNAME_NAME, piName });
1524c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson		return;
1534c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    }
1544c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1554c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // Note the content model is:
1564c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // <!ENTITY % instructions "
1574c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // %char-instructions;
1584c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // | xsl:processing-instruction
1594c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // | xsl:comment
1604c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // | xsl:element
1614c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // | xsl:attribute
1624c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // ">
1634c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    String data = transformer.transformToString(this);
1644c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1654c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    try
1664c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    {
1674c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      transformer.getResultTreeHandler().processingInstruction(piName, data);
1684c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    }
1694c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    catch(org.xml.sax.SAXException se)
1704c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    {
1714c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      throw new TransformerException(se);
1724c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    }
1734c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
1744c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1754c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  /**
1764c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * Add a child to the child list.
1774c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
1784c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @param newChild Child to add to child list
1794c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
1804c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @return The child just added to the child list
1814c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   *
1824c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   * @throws DOMException
1834c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson   */
1844c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  public ElemTemplateElement appendChild(ElemTemplateElement newChild)
1854c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  {
1864c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1874c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    int type = ((ElemTemplateElement) newChild).getXSLToken();
1884c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1894c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    switch (type)
1904c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    {
1914c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
1924c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    // char-instructions
1934c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_TEXTLITERALRESULT :
1944c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_APPLY_TEMPLATES :
1954c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_APPLY_IMPORTS :
1964c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_CALLTEMPLATE :
1974c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_FOREACH :
1984c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_VALUEOF :
1994c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_COPY_OF :
2004c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_NUMBER :
2014c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_CHOOSE :
2024c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_IF :
2034c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_TEXT :
2044c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_COPY :
2054c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_VARIABLE :
2064c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    case Constants.ELEMNAME_MESSAGE :
2074c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2084c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      // instructions
2094c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      // case Constants.ELEMNAME_PI:
2104c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      // case Constants.ELEMNAME_COMMENT:
2114c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      // case Constants.ELEMNAME_ELEMENT:
2124c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      // case Constants.ELEMNAME_ATTRIBUTE:
2134c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      break;
2144c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    default :
2154c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson      error(XSLTErrorResources.ER_CANNOT_ADD,
2164c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson            new Object[]{ newChild.getNodeName(),
2174c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson                          this.getNodeName() });  //"Can not add " +((ElemTemplateElement)newChild).m_elemName +
2184c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2194c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    //" to " + this.m_elemName);
2204c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    }
2214c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson
2224c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson    return super.appendChild(newChild);
2234c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson  }
2244c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson}
225