string GetFormat(XslTransformProcessor p)
        {
            XslNumberFormatter nf = GetNumberFormatter(p);

            if (this.value != null)
            {
                double result = p.EvaluateNumber(this.value);
                //Do we need to round the result here???
                //result = (int) ((result - (int) result >= 0.5) ? result + 1 : result);
                return(nf.Format(result));
            }

            switch (this.level)
            {
            case XslNumberingLevel.Single:
                int hit = NumberSingle(p);
                return(nf.Format(hit, hit != 0));

            case XslNumberingLevel.Multiple:
                return(nf.Format(NumberMultiple(p)));

            case XslNumberingLevel.Any:
                hit = NumberAny(p);
                return(nf.Format(hit, hit != 0));

            default:
                throw new XsltException("Should not get here", null, p.CurrentNode);
            }
        }
Exemplo n.º 2
0
        private string GetFormat(XslTransformProcessor p)
        {
            XslNumber.XslNumberFormatter numberFormatter = this.GetNumberFormatter(p);
            if (this.value != null)
            {
                double num = p.EvaluateNumber(this.value);
                return(numberFormatter.Format(num));
            }
            switch (this.level)
            {
            case XslNumberingLevel.Single:
            {
                int num2 = this.NumberSingle(p);
                return(numberFormatter.Format((double)num2, num2 != 0));
            }

            case XslNumberingLevel.Multiple:
                return(numberFormatter.Format(this.NumberMultiple(p)));

            case XslNumberingLevel.Any:
            {
                int num2 = this.NumberAny(p);
                return(numberFormatter.Format((double)num2, num2 != 0));
            }

            default:
                throw new XsltException("Should not get here", null, p.CurrentNode);
            }
        }
Exemplo n.º 3
0
		string GetFormat (XslTransformProcessor p)
		{
			XslNumberFormatter nf = GetNumberFormatter (p);
			
			if (this.value != null) {
				double result = p.EvaluateNumber (this.value);
				//Do we need to round the result here???
				//result = (int) ((result - (int) result >= 0.5) ? result + 1 : result); 
				return nf.Format (result);
			}
			
			switch (this.level) {
			case XslNumberingLevel.Single:
				int hit = NumberSingle (p);
				return nf.Format (hit, hit != 0);
			case XslNumberingLevel.Multiple:
				return nf.Format (NumberMultiple (p));
			case XslNumberingLevel.Any:
				hit = NumberAny (p);
				return nf.Format (hit, hit != 0);
			default:
				throw new XsltException ("Should not get here", null, p.CurrentNode);
			}
		}