~vcs-imports/xena/trunk

« back to all changes in this revision

Viewing changes to ext/src/xalan-j_2_7_1/src/org/apache/xalan/templates/AVTPartSimple.java

  • Committer: matthewoliver
  • Date: 2009-12-10 03:18:07 UTC
  • Revision ID: vcs-imports@canonical.com-20091210031807-l086qguzdlljtkl9
Merged Xena Testing into Xena Stable for the Xena 5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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,v 1.2 2009/12/10 03:18:29 matthewoliver Exp $
 
20
 */
 
21
package org.apache.xalan.templates;
 
22
 
 
23
import org.apache.xml.utils.FastStringBuffer;
 
24
import org.apache.xpath.XPathContext;
 
25
 
 
26
/**
 
27
 * Simple string part of a complex AVT.
 
28
 * @xsl.usage internal
 
29
 */
 
30
public 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
}