• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: WhiteSpaceInfo.java 468643 2006-10-28 06:56:03Z minchau $
20  */
21 package org.apache.xalan.templates;
22 
23 import org.apache.xpath.XPath;
24 
25 /**
26  * This is used as a special "fake" template that can be
27  * handled by the TemplateList to do pattern matching
28  * on nodes.
29  */
30 public class WhiteSpaceInfo extends ElemTemplate
31 {
32     static final long serialVersionUID = 6389208261999943836L;
33 
34   /** Flag indicating whether whitespaces should be stripped.
35    *  @serial        */
36   private boolean m_shouldStripSpace;
37 
38   /**
39    * Return true if this element specifies that the node that
40    * matches the match pattern should be stripped, otherwise
41    * the space should be preserved.
42    *
43    * @return value of m_shouldStripSpace flag
44    */
getShouldStripSpace()45   public boolean getShouldStripSpace()
46   {
47     return m_shouldStripSpace;
48   }
49 
50   /**
51    * Constructor WhiteSpaceInfo
52    * @param thisSheet The current stylesheet
53    */
WhiteSpaceInfo(Stylesheet thisSheet)54   public WhiteSpaceInfo(Stylesheet thisSheet)
55   {
56   	setStylesheet(thisSheet);
57   }
58 
59 
60   /**
61    * Constructor WhiteSpaceInfo
62    *
63    *
64    * @param matchPattern Match pattern
65    * @param shouldStripSpace Flag indicating whether or not
66    * to strip whitespaces
67    * @param thisSheet The current stylesheet
68    */
WhiteSpaceInfo(XPath matchPattern, boolean shouldStripSpace, Stylesheet thisSheet)69   public WhiteSpaceInfo(XPath matchPattern, boolean shouldStripSpace, Stylesheet thisSheet)
70   {
71 
72     m_shouldStripSpace = shouldStripSpace;
73 
74     setMatch(matchPattern);
75 
76     setStylesheet(thisSheet);
77   }
78 
79   /**
80    * This function is called to recompose() all of the WhiteSpaceInfo elements.
81    */
recompose(StylesheetRoot root)82   public void recompose(StylesheetRoot root)
83   {
84     root.recomposeWhiteSpaceInfo(this);
85   }
86 
87 }
88