public string FormatNumberDynamic(double value, string formatPicture, XmlQualifiedName decimalFormatName, string errorMessageName) { DecimalFormatDecl format; if (decimalFormats != null && decimalFormats.Contains(decimalFormatName)) { format = decimalFormats[decimalFormatName]; } else { if (decimalFormatName != DecimalFormatDecl.Default.Name) { throw new XslTransformException(Res.Xslt_NoDecimalFormat, errorMessageName); } format = DecimalFormatDecl.Default; } DecimalFormatter formatter = CreateDecimalFormatter(formatPicture, format.InfinitySymbol, format.NanSymbol, new string(format.Characters)); return(formatter.Format(value)); }