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: WhiteSpaceInfo.java 468643 2006-10-28 06:56:03Z minchau $
020     */
021    package org.apache.xalan.templates;
022    
023    import org.apache.xpath.XPath;
024    
025    /**
026     * This is used as a special "fake" template that can be
027     * handled by the TemplateList to do pattern matching
028     * on nodes.
029     */
030    public class WhiteSpaceInfo extends ElemTemplate
031    {
032        static final long serialVersionUID = 6389208261999943836L;
033    
034      /** Flag indicating whether whitespaces should be stripped.
035       *  @serial        */
036      private boolean m_shouldStripSpace;
037    
038      /**
039       * Return true if this element specifies that the node that
040       * matches the match pattern should be stripped, otherwise
041       * the space should be preserved.
042       *
043       * @return value of m_shouldStripSpace flag
044       */
045      public boolean getShouldStripSpace()
046      {
047        return m_shouldStripSpace;
048      }
049      
050      /**
051       * Constructor WhiteSpaceInfo
052       * @param thisSheet The current stylesheet
053       */
054      public WhiteSpaceInfo(Stylesheet thisSheet)
055      {
056            setStylesheet(thisSheet);
057      }
058    
059    
060      /**
061       * Constructor WhiteSpaceInfo
062       *
063       *
064       * @param matchPattern Match pattern
065       * @param shouldStripSpace Flag indicating whether or not
066       * to strip whitespaces
067       * @param thisSheet The current stylesheet
068       */
069      public WhiteSpaceInfo(XPath matchPattern, boolean shouldStripSpace, Stylesheet thisSheet)
070      {
071    
072        m_shouldStripSpace = shouldStripSpace;
073    
074        setMatch(matchPattern);
075    
076        setStylesheet(thisSheet);
077      }
078    
079      /**
080       * This function is called to recompose() all of the WhiteSpaceInfo elements.
081       */
082      public void recompose(StylesheetRoot root)
083      {
084        root.recomposeWhiteSpaceInfo(this);
085      }
086    
087    }