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