blob: f423e75e9edf5a2a140283ed959a44fbd6a13d4d [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008 Standards for Technology in Automotive Retail
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* David Carver - STAR - bug 224197 - initial API and implementation
* based on work from Apache Xalan 2.7.0
*******************************************************************************/
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: ProcessorStripSpace.java,v 1.3 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
import java.util.Vector;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.Stylesheet;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.WhiteSpaceInfo;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.xml.sax.Attributes;
/**
* TransformerFactory for xsl:strip-space markup.
*
* <pre>
* &lt;!ELEMENT xsl:strip-space EMPTY&gt;
* &lt;!ATTLIST xsl:strip-space elements CDATA #REQUIRED&gt;
* </pre>
*/
class ProcessorStripSpace extends ProcessorPreserveSpace {
static final long serialVersionUID = -5594493198637899591L;
/**
* Receive notification of the start of an strip-space element.
*
* @param handler
* The calling StylesheetHandler/TemplatesBuilder.
* @param uri
* The Namespace URI, or the empty string if the element has no
* Namespace URI or if Namespace processing is not being
* performed.
* @param localName
* The local name (without prefix), or the empty string if
* Namespace processing is not being performed.
* @param rawName
* The raw XML 1.0 name (with prefix), or the empty string if raw
* names are not available.
* @param attributes
* The attributes attached to the element. If there are no
* attributes, it shall be an empty Attributes object.
*/
@Override
public void startElement(StylesheetHandler handler, String uri,
String localName, String rawName, Attributes attributes)
throws org.xml.sax.SAXException {
Stylesheet thisSheet = handler.getStylesheet();
WhitespaceInfoPaths paths = new WhitespaceInfoPaths(thisSheet);
setPropertiesFromAttributes(handler, rawName, attributes, paths);
Vector xpaths = paths.getElements();
for (int i = 0; i < xpaths.size(); i++) {
WhiteSpaceInfo wsi = new WhiteSpaceInfo(
(XPath) xpaths.elementAt(i), true, thisSheet);
wsi.setUid(handler.nextUid());
thisSheet.setStripSpaces(wsi);
}
paths.clearElements();
}
}