• 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: ProcessorDecimalFormat.java 468640 2006-10-28 06:53:53Z minchau $
20  */
21 package org.apache.xalan.processor;
22 
23 import org.apache.xalan.templates.DecimalFormatProperties;
24 import org.xml.sax.Attributes;
25 
26 /**
27  * Process xsl:decimal-format by creating a DecimalFormatProperties
28  * object and passing it to the stylesheet.
29  *
30  * @see org.apache.xalan.templates.Stylesheet#setDecimalFormat
31  * @see org.apache.xalan.templates.DecimalFormatProperties
32  * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a>
33  * @xsl.usage internal
34  */
35 class ProcessorDecimalFormat extends XSLTElementProcessor
36 {
37     static final long serialVersionUID = -5052904382662921627L;
38 
39   /**
40    * Receive notification of the start of an element.
41    *
42    * @param handler The calling StylesheetHandler/TemplatesBuilder.
43    * @param uri The Namespace URI, or the empty string if the
44    *        element has no Namespace URI or if Namespace
45    *        processing is not being performed.
46    * @param localName The local name (without prefix), or the
47    *        empty string if Namespace processing is not being
48    *        performed.
49    * @param rawName The raw XML 1.0 name (with prefix), or the
50    *        empty string if raw names are not available.
51    * @param attributes The attributes attached to the element.  If
52    *        there are no attributes, it shall be an empty
53    *        Attributes object.
54    * @see org.apache.xalan.processor.StylesheetHandler#startElement
55    * @see org.apache.xalan.processor.StylesheetHandler#endElement
56    * @see org.xml.sax.ContentHandler#startElement
57    * @see org.xml.sax.ContentHandler#endElement
58    * @see org.xml.sax.Attributes
59    */
startElement( StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)60   public void startElement(
61           StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
62             throws org.xml.sax.SAXException
63   {
64 
65     DecimalFormatProperties dfp = new DecimalFormatProperties(handler.nextUid());
66 
67     dfp.setDOMBackPointer(handler.getOriginatingNode());
68     dfp.setLocaterInfo(handler.getLocator());
69 
70     setPropertiesFromAttributes(handler, rawName, attributes, dfp);
71     handler.getStylesheet().setDecimalFormat(dfp);
72 
73     handler.getStylesheet().appendChild(dfp);
74   }
75 }
76