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: AVTPartSimple.java 468643 2006-10-28 06:56:03Z minchau $
20 */
21package org.apache.xalan.templates;
22
23import org.apache.xml.utils.FastStringBuffer;
24import org.apache.xpath.XPathContext;
25
26/**
27 * Simple string part of a complex AVT.
28 * @xsl.usage internal
29 */
30public class AVTPartSimple extends AVTPart
31{
32    static final long serialVersionUID = -3744957690598727913L;
33
34  /**
35   * Simple string value;
36   * @serial
37   */
38  private String m_val;
39
40  /**
41   * Construct a simple AVT part.
42   * @param val A pure string section of an AVT.
43   */
44  public AVTPartSimple(String val)
45  {
46    m_val = val;
47  }
48
49  /**
50   * Get the AVT part as the original string.
51   *
52   * @return the AVT part as the original string.
53   */
54  public String getSimpleString()
55  {
56    return m_val;
57  }
58
59  /**
60   * This function is used to fixup variables from QNames to stack frame
61   * indexes at stylesheet build time.
62   * @param vars List of QNames that correspond to variables.  This list
63   * should be searched backwards for the first qualified name that
64   * corresponds to the variable reference qname.  The position of the
65   * QName in the vector from the start of the vector will be its position
66   * in the stack frame (but variables above the globalsTop value will need
67   * to be offset to the current stack frame).
68   */
69  public void fixupVariables(java.util.Vector vars, int globalsSize)
70  {
71    // no-op
72  }
73
74
75  /**
76   * Write the value into the buffer.
77   *
78   * @param xctxt An XPathContext object, providing infomation specific
79   * to this invocation and this thread. Maintains SAX state, variables,
80   * error handler and  so on, so the transformation/XPath object itself
81   * can be simultaneously invoked from multiple threads.
82   * @param buf Buffer to write into.
83   * @param context The current source tree context.
84   * @param nsNode The current namespace context (stylesheet tree context).
85   */
86  public void evaluate(XPathContext xctxt, FastStringBuffer buf,
87                       int context,
88                       org.apache.xml.utils.PrefixResolver nsNode)
89  {
90    buf.append(m_val);
91  }
92  /**
93   * @see XSLTVisitable#callVisitors(XSLTVisitor)
94   */
95  public void callVisitors(XSLTVisitor visitor)
96  {
97  	// Don't do anything for the subpart for right now.
98  }
99
100}
101