KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > processor > ProcessorText


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: ProcessorText.java,v 1.8 2004/02/11 18:15:51 minchau Exp $
18  */

19 package org.apache.xalan.processor;
20
21 import org.apache.xalan.templates.ElemTemplateElement;
22 import org.apache.xalan.templates.ElemText;
23
24 /**
25  * Process xsl:text.
26  * @see <a HREF="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
27  * @see <a HREF="http://www.w3.org/TR/xslt#element-text">element-text in XSLT Specification</a>
28  */

29 public class ProcessorText extends ProcessorTemplateElem
30 {
31
32   /**
33    * Append the current template element to the current
34    * template element, and then push it onto the current template
35    * element stack.
36    *
37    * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
38    * @param elem non-null reference to a {@link org.apache.xalan.templates.ElemText}.
39    *
40    * @throws org.xml.sax.SAXException Any SAX exception, possibly
41    * wrapping another exception.
42    */

43   protected void appendAndPush(
44           StylesheetHandler handler, ElemTemplateElement elem)
45             throws org.xml.sax.SAXException JavaDoc
46   {
47
48     // Don't push this element onto the element stack.
49
ProcessorCharacters charProcessor =
50       (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text");
51
52     charProcessor.setXslTextElement((ElemText) elem);
53
54     ElemTemplateElement parent = handler.getElemTemplateElement();
55
56     parent.appendChild(elem);
57     elem.setDOMBackPointer(handler.getOriginatingNode());
58   }
59
60   /**
61    * Receive notification of the end of an element.
62    *
63    * @param name The element type name.
64    * @param attributes The specified or defaulted attributes.
65    *
66    * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
67    * @param uri The Namespace URI, or an empty string.
68    * @param localName The local name (without prefix), or empty string if not namespace processing.
69    * @param rawName The qualified name (with prefix).
70    */

71   public void endElement(
72           StylesheetHandler handler, String JavaDoc uri, String JavaDoc localName, String JavaDoc rawName)
73             throws org.xml.sax.SAXException JavaDoc
74   {
75
76     ProcessorCharacters charProcessor
77       = (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text");
78
79     charProcessor.setXslTextElement(null);
80
81   }
82 }
83
Popular Tags