1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 /* 19 * $Id: ProcessorText.java 468640 2006-10-28 06:53:53Z minchau $ 20 */ 21 package org.apache.xalan.processor; 22 23 import org.apache.xalan.templates.ElemTemplateElement; 24 import org.apache.xalan.templates.ElemText; 25 26 /** 27 * Process xsl:text. 28 * @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a> 29 * @see <a href="http://www.w3.org/TR/xslt#element-text">element-text in XSLT Specification</a> 30 */ 31 public class ProcessorText extends ProcessorTemplateElem 32 { 33 static final long serialVersionUID = 5170229307201307523L; 34 35 /** 36 * Append the current template element to the current 37 * template element, and then push it onto the current template 38 * element stack. 39 * 40 * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. 41 * @param elem non-null reference to a {@link org.apache.xalan.templates.ElemText}. 42 * 43 * @throws org.xml.sax.SAXException Any SAX exception, possibly 44 * wrapping another exception. 45 */ appendAndPush( StylesheetHandler handler, ElemTemplateElement elem)46 protected void appendAndPush( 47 StylesheetHandler handler, ElemTemplateElement elem) 48 throws org.xml.sax.SAXException 49 { 50 51 // Don't push this element onto the element stack. 52 ProcessorCharacters charProcessor = 53 (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text"); 54 55 charProcessor.setXslTextElement((ElemText) elem); 56 57 ElemTemplateElement parent = handler.getElemTemplateElement(); 58 59 parent.appendChild(elem); 60 elem.setDOMBackPointer(handler.getOriginatingNode()); 61 } 62 63 /** 64 * Receive notification of the end of an element. 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 */ endElement( StylesheetHandler handler, String uri, String localName, String rawName)71 public void endElement( 72 StylesheetHandler handler, String uri, String localName, String rawName) 73 throws org.xml.sax.SAXException 74 { 75 76 ProcessorCharacters charProcessor 77 = (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text"); 78 79 charProcessor.setXslTextElement(null); 80 81 } 82 } 83