xslt-processor 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/umd/xpath/expressions/binary-expr.d.ts +1 -1
  3. package/umd/xpath/expressions/function-call-expr.d.ts +1 -1
  4. package/umd/xpath/expressions/location-expr.d.ts +1 -1
  5. package/umd/xpath/expressions/step-expr.d.ts +1 -1
  6. package/umd/xpath/functions/non-standard.d.ts +1 -1
  7. package/umd/xpath/functions/standard.d.ts +7 -1
  8. package/umd/xpath/index.d.ts +1 -1
  9. package/umd/xpath/node-test-comment.d.ts +1 -1
  10. package/umd/xpath/node-test-element-or-attribute.d.ts +1 -1
  11. package/umd/xpath/node-test-name.d.ts +1 -1
  12. package/umd/xpath/node-test-nc.d.ts +1 -1
  13. package/umd/xpath/node-test-pi.d.ts +1 -1
  14. package/umd/xpath/node-test-text.d.ts +1 -1
  15. package/umd/xpath/xpath.d.ts +1 -1
  16. package/umd/{xpath → xslt}/expr-context.d.ts +3 -1
  17. package/umd/xslt/xslt-decimal-format-settings.d.ts +28 -0
  18. package/umd/xslt/xslt.d.ts +2 -0
  19. package/umd/xslt-processor.js +2 -2
  20. package/umd/xslt-processor.js.map +1 -1
  21. package/xpath/expressions/binary-expr.d.ts +1 -1
  22. package/xpath/expressions/function-call-expr.d.ts +1 -1
  23. package/xpath/expressions/function-call-expr.js +1 -0
  24. package/xpath/expressions/function-call-expr.js.map +1 -1
  25. package/xpath/expressions/location-expr.d.ts +1 -1
  26. package/xpath/expressions/step-expr.d.ts +1 -1
  27. package/xpath/functions/non-standard.d.ts +1 -1
  28. package/xpath/functions/standard.d.ts +7 -1
  29. package/xpath/functions/standard.js +93 -2
  30. package/xpath/functions/standard.js.map +1 -1
  31. package/xpath/index.d.ts +1 -1
  32. package/xpath/index.js +1 -1
  33. package/xpath/index.js.map +1 -1
  34. package/xpath/node-test-comment.d.ts +1 -1
  35. package/xpath/node-test-element-or-attribute.d.ts +1 -1
  36. package/xpath/node-test-name.d.ts +1 -1
  37. package/xpath/node-test-nc.d.ts +1 -1
  38. package/xpath/node-test-pi.d.ts +1 -1
  39. package/xpath/node-test-text.d.ts +1 -1
  40. package/xpath/xpath.d.ts +1 -1
  41. package/{xpath → xslt}/expr-context.d.ts +3 -1
  42. package/{xpath → xslt}/expr-context.js +20 -8
  43. package/xslt/expr-context.js.map +1 -0
  44. package/xslt/xslt-decimal-format-settings.d.ts +28 -0
  45. package/xslt/xslt-decimal-format-settings.js +3 -0
  46. package/xslt/xslt-decimal-format-settings.js.map +1 -0
  47. package/xslt/xslt.d.ts +2 -0
  48. package/xslt/xslt.js +43 -8
  49. package/xslt/xslt.js.map +1 -1
  50. package/xpath/expr-context.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xslt-processor",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "A JavaScript XSLT Processor",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "../expr-context";
1
+ import { ExprContext } from "../../xslt/expr-context";
2
2
  import { BooleanValue } from "../values/boolean-value";
3
3
  import { Expression } from "./expression";
4
4
  export declare class BinaryExpr extends Expression {
@@ -1,4 +1,4 @@
1
- import { ExprContext } from '../expr-context';
1
+ import { ExprContext } from '../../xslt/expr-context';
2
2
  import { Expression } from './expression';
3
3
  export declare class FunctionCallExpr extends Expression {
4
4
  name: any;
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "../expr-context";
1
+ import { ExprContext } from "../../xslt/expr-context";
2
2
  import { NodeSetValue } from "../values/node-set-value";
3
3
  import { Expression } from "./expression";
4
4
  import { XPath } from "../xpath";
@@ -1,4 +1,4 @@
1
- import { ExprContext } from '../expr-context';
1
+ import { ExprContext } from '../../xslt/expr-context';
2
2
  import { NodeSetValue } from '../values/node-set-value';
3
3
  import { Expression } from './expression';
4
4
  import { XPath } from '../xpath';
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "../expr-context";
1
+ import { ExprContext } from "../../xslt/expr-context";
2
2
  import { NodeSetValue, StringValue } from "../values";
3
3
  export declare function extCardinal(context: ExprContext): NodeSetValue;
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "../expr-context";
1
+ import { ExprContext } from "../../xslt/expr-context";
2
2
  import { BooleanValue, NodeSetValue, NumberValue, StringValue } from "../values";
3
3
  export declare function boolean(context: ExprContext): BooleanValue;
4
4
  export declare function ceiling(context: ExprContext): NumberValue;
@@ -8,6 +8,12 @@ export declare function count(context: ExprContext): NumberValue;
8
8
  export declare function current(context: ExprContext): NodeSetValue;
9
9
  export declare function endsWith(context: ExprContext): BooleanValue;
10
10
  export declare function _false(): BooleanValue;
11
+ /**
12
+ * XPath `format-number` function implementation.
13
+ * @param context The Expression Context.
14
+ * @returns A formatted number as string.
15
+ */
16
+ export declare function formatNumber(context: ExprContext): StringValue;
11
17
  export declare function floor(context: ExprContext): NumberValue;
12
18
  export declare function generateId(context: ExprContext): StringValue;
13
19
  export declare function id(context: ExprContext): NodeSetValue;
@@ -1,4 +1,4 @@
1
- export * from './expr-context';
1
+ export * from '../xslt/expr-context';
2
2
  export * from './node-test-any';
3
3
  export * from './node-test-comment';
4
4
  export * from './node-test-element-or-attribute';
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "./expr-context";
1
+ import { ExprContext } from "../xslt/expr-context";
2
2
  import { BooleanValue } from "./values/boolean-value";
3
3
  export declare class NodeTestComment {
4
4
  evaluate(ctx: ExprContext): BooleanValue;
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "./expr-context";
1
+ import { ExprContext } from "../xslt/expr-context";
2
2
  import { BooleanValue } from "./values/boolean-value";
3
3
  export declare class NodeTestElementOrAttribute {
4
4
  evaluate(context: ExprContext): BooleanValue;
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "./expr-context";
1
+ import { ExprContext } from "../xslt/expr-context";
2
2
  import { BooleanValue } from "./values/boolean-value";
3
3
  export declare class NodeTestName {
4
4
  name: string;
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "./expr-context";
1
+ import { ExprContext } from "../xslt/expr-context";
2
2
  import { BooleanValue } from "./values/boolean-value";
3
3
  export declare class NodeTestNC {
4
4
  regex: RegExp;
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "./expr-context";
1
+ import { ExprContext } from "../xslt/expr-context";
2
2
  import { BooleanValue } from "./values/boolean-value";
3
3
  export declare class NodeTestPI {
4
4
  target: any;
@@ -1,4 +1,4 @@
1
- import { ExprContext } from "./expr-context";
1
+ import { ExprContext } from "../xslt/expr-context";
2
2
  import { BooleanValue } from "./values/boolean-value";
3
3
  export declare class NodeTestText {
4
4
  evaluate(ctx: ExprContext): BooleanValue;
@@ -1,4 +1,4 @@
1
- import { ExprContext } from './expr-context';
1
+ import { ExprContext } from '../xslt/expr-context';
2
2
  import { BinaryExpr, FunctionCallExpr, LiteralExpr, LocationExpr, NumberExpr, PathExpr, PredicateExpr, StepExpr, TokenExpr, UnaryMinusExpr, UnionExpr, VariableExpr } from './expressions';
3
3
  import { Expression } from './expressions/expression';
4
4
  import { NodeTestAny } from './node-test-any';
@@ -1,4 +1,5 @@
1
1
  import { XNode } from '../dom';
2
+ import { XsltDecimalFormatSettings } from './xslt-decimal-format-settings';
2
3
  /** XPath expression evaluation context. An XPath context consists of a
3
4
  * DOM node, a list of DOM nodes that contains this node, a number
4
5
  * that represents the position of the single node in the list, and a
@@ -47,6 +48,7 @@ export declare class ExprContext {
47
48
  ignoreNonElementNodesForNTA: any;
48
49
  parent: ExprContext;
49
50
  root: XNode;
51
+ decimalFormatSettings: XsltDecimalFormatSettings;
50
52
  inApplyTemplates: boolean;
51
53
  baseTemplateMatched: boolean;
52
54
  /**
@@ -70,7 +72,7 @@ export declare class ExprContext {
70
72
  * @param opt_returnOnFirstMatch TODO
71
73
  * @param opt_ignoreNonElementNodesForNTA TODO
72
74
  */
73
- constructor(nodeList: XNode[], outputNodeList: XNode[], opt_position?: number, opt_outputPosition?: number, opt_outputDepth?: number, opt_parent?: ExprContext, opt_caseInsensitive?: any, opt_ignoreAttributesWithoutValue?: any, opt_returnOnFirstMatch?: any, opt_ignoreNonElementNodesForNTA?: any);
75
+ constructor(nodeList: XNode[], outputNodeList: XNode[], opt_position?: number, opt_outputPosition?: number, opt_outputDepth?: number, opt_decimalFormatSettings?: XsltDecimalFormatSettings, opt_parent?: ExprContext, opt_caseInsensitive?: any, opt_ignoreAttributesWithoutValue?: any, opt_returnOnFirstMatch?: any, opt_ignoreNonElementNodesForNTA?: any);
74
76
  /**
75
77
  * clone() -- creates a new context with the current context as
76
78
  * parent. If passed as argument to clone(), the new context has a
@@ -0,0 +1,28 @@
1
+ /**
2
+ * According to https://www.w3schools.com/xml/ref_xsl_el_decimal-format.asp:
3
+ *
4
+ * @property {string} name: Optional. Specifies a name for this format.
5
+ * @property {string} decimalSeparator: Optional. Specifies the decimal point character. Default is ".".
6
+ * @property {string} groupingSeparator: Optional. Specifies the thousands separator character. Default is ",".
7
+ * @property {string} infinity: Optional. Specifies the string used to represent infinity. Default is "Infinity".
8
+ * @property {string} minusSign: Optional. Specifies the character to represent negative numbers. Default is "-".
9
+ * @property {string} naN: Optional. Specifies the string used when the value is not a number". Default is "NaN".
10
+ * @property {string} percent: Optional. Specifies the percentage sign character. Default is "%".
11
+ * @property {string} perMille: Optional. Specifies the per thousand sign character. Default is "‰".
12
+ * @property {string} zeroDigit: Optional. Specifies the digit zero character. Default is "0".
13
+ * @property {string} digit: Optional. Specifies the character used to indicate a place where a digit is required. Default is #.
14
+ * @property {string} patternSeparator: Optional. Specifies the character used to separate positive and negative subpatterns in a format pattern. Default is ";".
15
+ */
16
+ export type XsltDecimalFormatSettings = {
17
+ name?: string;
18
+ decimalSeparator: string;
19
+ groupingSeparator: string;
20
+ infinity: string;
21
+ minusSign: string;
22
+ naN: string;
23
+ percent: string;
24
+ perMille: string;
25
+ zeroDigit: string;
26
+ digit: string;
27
+ patternSeparator: string;
28
+ };
@@ -1,6 +1,7 @@
1
1
  import { XDocument, XNode } from '../dom';
2
2
  import { ExprContext, XPath } from '../xpath';
3
3
  import { XsltOptions } from './xslt-options';
4
+ import { XsltDecimalFormatSettings } from './xslt-decimal-format-settings';
4
5
  /**
5
6
  * The main class for XSL-T processing. The implementation is NOT
6
7
  * complete; some xsl element are left out.
@@ -28,6 +29,7 @@ import { XsltOptions } from './xslt-options';
28
29
  export declare class Xslt {
29
30
  xPath: XPath;
30
31
  options: XsltOptions;
32
+ decimalFormatSettings: XsltDecimalFormatSettings;
31
33
  outputDocument: XDocument;
32
34
  outputMethod: string;
33
35
  outputOmitXmlDeclaration: string;