001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 /*
019 * $Id: AVTPartSimple.java 468643 2006-10-28 06:56:03Z minchau $
020 */
021 package org.apache.xalan.templates;
022
023 import org.apache.xml.utils.FastStringBuffer;
024 import org.apache.xpath.XPathContext;
025
026 /**
027 * Simple string part of a complex AVT.
028 * @xsl.usage internal
029 */
030 public class AVTPartSimple extends AVTPart
031 {
032 static final long serialVersionUID = -3744957690598727913L;
033
034 /**
035 * Simple string value;
036 * @serial
037 */
038 private String m_val;
039
040 /**
041 * Construct a simple AVT part.
042 * @param val A pure string section of an AVT.
043 */
044 public AVTPartSimple(String val)
045 {
046 m_val = val;
047 }
048
049 /**
050 * Get the AVT part as the original string.
051 *
052 * @return the AVT part as the original string.
053 */
054 public String getSimpleString()
055 {
056 return m_val;
057 }
058
059 /**
060 * This function is used to fixup variables from QNames to stack frame
061 * indexes at stylesheet build time.
062 * @param vars List of QNames that correspond to variables. This list
063 * should be searched backwards for the first qualified name that
064 * corresponds to the variable reference qname. The position of the
065 * QName in the vector from the start of the vector will be its position
066 * in the stack frame (but variables above the globalsTop value will need
067 * to be offset to the current stack frame).
068 */
069 public void fixupVariables(java.util.Vector vars, int globalsSize)
070 {
071 // no-op
072 }
073
074
075 /**
076 * Write the value into the buffer.
077 *
078 * @param xctxt An XPathContext object, providing infomation specific
079 * to this invocation and this thread. Maintains SAX state, variables,
080 * error handler and so on, so the transformation/XPath object itself
081 * can be simultaneously invoked from multiple threads.
082 * @param buf Buffer to write into.
083 * @param context The current source tree context.
084 * @param nsNode The current namespace context (stylesheet tree context).
085 */
086 public void evaluate(XPathContext xctxt, FastStringBuffer buf,
087 int context,
088 org.apache.xml.utils.PrefixResolver nsNode)
089 {
090 buf.append(m_val);
091 }
092 /**
093 * @see XSLTVisitable#callVisitors(XSLTVisitor)
094 */
095 public void callVisitors(XSLTVisitor visitor)
096 {
097 // Don't do anything for the subpart for right now.
098 }
099
100 }