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: ProcessorDecimalFormat.java 468640 2006-10-28 06:53:53Z minchau $
020     */
021    package org.apache.xalan.processor;
022    
023    import org.apache.xalan.templates.DecimalFormatProperties;
024    import org.xml.sax.Attributes;
025    
026    /**
027     * Process xsl:decimal-format by creating a DecimalFormatProperties 
028     * object and passing it to the stylesheet.
029     * 
030     * @see org.apache.xalan.templates.Stylesheet#setDecimalFormat
031     * @see org.apache.xalan.templates.DecimalFormatProperties
032     * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a>
033     * @xsl.usage internal
034     */
035    class ProcessorDecimalFormat extends XSLTElementProcessor
036    {
037        static final long serialVersionUID = -5052904382662921627L;
038    
039      /**
040       * Receive notification of the start of an element.
041       *
042       * @param handler The calling StylesheetHandler/TemplatesBuilder.
043       * @param uri The Namespace URI, or the empty string if the
044       *        element has no Namespace URI or if Namespace
045       *        processing is not being performed.
046       * @param localName The local name (without prefix), or the
047       *        empty string if Namespace processing is not being
048       *        performed.
049       * @param rawName The raw XML 1.0 name (with prefix), or the
050       *        empty string if raw names are not available.
051       * @param attributes The attributes attached to the element.  If
052       *        there are no attributes, it shall be an empty
053       *        Attributes object.
054       * @see org.apache.xalan.processor.StylesheetHandler#startElement
055       * @see org.apache.xalan.processor.StylesheetHandler#endElement
056       * @see org.xml.sax.ContentHandler#startElement
057       * @see org.xml.sax.ContentHandler#endElement
058       * @see org.xml.sax.Attributes
059       */
060      public void startElement(
061              StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
062                throws org.xml.sax.SAXException
063      {
064    
065        DecimalFormatProperties dfp = new DecimalFormatProperties(handler.nextUid());
066        
067        dfp.setDOMBackPointer(handler.getOriginatingNode());
068        dfp.setLocaterInfo(handler.getLocator());
069        
070        setPropertiesFromAttributes(handler, rawName, attributes, dfp);
071        handler.getStylesheet().setDecimalFormat(dfp);
072        
073        handler.getStylesheet().appendChild(dfp);
074      }
075    }