xslt-processor 5.0.5 → 5.0.6

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.
package/dist/index.d.mts CHANGED
@@ -86,6 +86,22 @@ declare class XDocument extends XNode {
86
86
  */
87
87
  declare function domDocumentToXDocument(nativeNode: Document | Node): XDocument;
88
88
 
89
+ type XmlOutputOptions = {
90
+ cData: boolean;
91
+ escape: boolean;
92
+ selfClosingTags: boolean;
93
+ outputMethod: 'xml' | 'html' | 'text' | 'name' | 'xhtml';
94
+ outputVersion?: string;
95
+ itemSeparator?: string;
96
+ };
97
+
98
+ /**
99
+ * Returns the representation of a node as XML text.
100
+ * @param {XNode} node The starting node.
101
+ * @param {XmlOutputOptions} options XML output options.
102
+ * @returns The XML string.
103
+ */
104
+ declare function xmlTransformedText(node: XNode, options?: XmlOutputOptions): string;
89
105
  /**
90
106
  * Escape XML special markup characters: tag delimiter <, >, and entity
91
107
  * reference start delimiter &. The escaped string can be used in XML
@@ -1771,4 +1787,4 @@ declare class Xslt {
1771
1787
  protected isXsltElement(element: XNode, opt_wantedName?: string): boolean;
1772
1788
  }
1773
1789
 
1774
- export { ExprContext, XDocument, XNode, XPath, XmlParser, Xslt, type XsltOptions, domDocumentToXDocument, xmlEscapeText };
1790
+ export { ExprContext, XDocument, XNode, XPath, XmlParser, Xslt, type XsltOptions, domDocumentToXDocument, xmlEscapeText, xmlTransformedText };
package/dist/index.d.ts CHANGED
@@ -86,6 +86,22 @@ declare class XDocument extends XNode {
86
86
  */
87
87
  declare function domDocumentToXDocument(nativeNode: Document | Node): XDocument;
88
88
 
89
+ type XmlOutputOptions = {
90
+ cData: boolean;
91
+ escape: boolean;
92
+ selfClosingTags: boolean;
93
+ outputMethod: 'xml' | 'html' | 'text' | 'name' | 'xhtml';
94
+ outputVersion?: string;
95
+ itemSeparator?: string;
96
+ };
97
+
98
+ /**
99
+ * Returns the representation of a node as XML text.
100
+ * @param {XNode} node The starting node.
101
+ * @param {XmlOutputOptions} options XML output options.
102
+ * @returns The XML string.
103
+ */
104
+ declare function xmlTransformedText(node: XNode, options?: XmlOutputOptions): string;
89
105
  /**
90
106
  * Escape XML special markup characters: tag delimiter <, >, and entity
91
107
  * reference start delimiter &. The escaped string can be used in XML
@@ -1771,4 +1787,4 @@ declare class Xslt {
1771
1787
  protected isXsltElement(element: XNode, opt_wantedName?: string): boolean;
1772
1788
  }
1773
1789
 
1774
- export { ExprContext, XDocument, XNode, XPath, XmlParser, Xslt, type XsltOptions, domDocumentToXDocument, xmlEscapeText };
1790
+ export { ExprContext, XDocument, XNode, XPath, XmlParser, Xslt, type XsltOptions, domDocumentToXDocument, xmlEscapeText, xmlTransformedText };
package/dist/index.js CHANGED
@@ -7819,7 +7819,8 @@ __export(index_exports, {
7819
7819
  XmlParser: () => XmlParser,
7820
7820
  Xslt: () => Xslt,
7821
7821
  domDocumentToXDocument: () => domDocumentToXDocument,
7822
- xmlEscapeText: () => xmlEscapeText
7822
+ xmlEscapeText: () => xmlEscapeText,
7823
+ xmlTransformedText: () => xmlTransformedText
7823
7824
  });
7824
7825
  module.exports = __toCommonJS(index_exports);
7825
7826
 
@@ -11027,7 +11028,7 @@ function xmlTransformedTextRecursive(node, buffer, options) {
11027
11028
  }
11028
11029
  } else if (nodeType == DOM_COMMENT_NODE) {
11029
11030
  if (options.outputMethod !== "text") {
11030
- buffer.push(`<!-- ${nodeValue} -->`);
11031
+ buffer.push(`<!--${nodeValue}-->`);
11031
11032
  }
11032
11033
  } else if (nodeType === DOM_PROCESSING_INSTRUCTION_NODE) {
11033
11034
  if (options.outputMethod !== "text") {
@@ -11465,14 +11466,14 @@ var XmlParser = class {
11465
11466
  }
11466
11467
  if (htmlText.slice(i + 1, i + 4) === "!--") {
11467
11468
  let endTagIndex = htmlText.slice(i + 4).indexOf("-->");
11468
- if (endTagIndex) {
11469
+ if (endTagIndex >= 0) {
11469
11470
  let node = domCreateComment(xmlDocument, htmlText.slice(i + 4, i + endTagIndex + 4));
11470
11471
  domAppendChild(parent, node);
11471
11472
  i += endTagIndex + 6;
11472
11473
  }
11473
11474
  } else if (htmlText.slice(i + 1, i + 9) === "!DOCTYPE") {
11474
11475
  let endTagIndex = htmlText.slice(i + 9).indexOf(">");
11475
- if (endTagIndex) {
11476
+ if (endTagIndex >= 0) {
11476
11477
  const dtdValue = htmlText.slice(i + 9, i + endTagIndex + 9).trimStart();
11477
11478
  const node = domCreateDTDSection(xmlDocument, dtdValue);
11478
11479
  domAppendChild(parent, node);
@@ -11571,21 +11572,21 @@ var XmlParser = class {
11571
11572
  }
11572
11573
  if (xml.slice(i + 1, i + 4) === "!--") {
11573
11574
  let endTagIndex = xml.slice(i + 4).indexOf("-->");
11574
- if (endTagIndex) {
11575
+ if (endTagIndex >= 0) {
11575
11576
  let node = domCreateComment(xmlDocument, xml.slice(i + 4, i + endTagIndex + 4));
11576
11577
  domAppendChild(parent, node);
11577
11578
  i += endTagIndex + 6;
11578
11579
  }
11579
11580
  } else if (xml.slice(i + 1, i + 9) === "![CDATA[") {
11580
11581
  let endTagIndex = xml.slice(i + 9).indexOf("]]>");
11581
- if (endTagIndex) {
11582
+ if (endTagIndex >= 0) {
11582
11583
  let node = domCreateCDATASection(xmlDocument, xml.slice(i + 9, i + endTagIndex + 9));
11583
11584
  domAppendChild(parent, node);
11584
11585
  i += endTagIndex + 11;
11585
11586
  }
11586
11587
  } else if (xml.slice(i + 1, i + 9) === "!DOCTYPE") {
11587
11588
  let endTagIndex = xml.slice(i + 9).indexOf(">");
11588
- if (endTagIndex) {
11589
+ if (endTagIndex >= 0) {
11589
11590
  const dtdValue = xml.slice(i + 9, i + endTagIndex + 9).trimStart();
11590
11591
  const node = domCreateDTDSection(xmlDocument, dtdValue);
11591
11592
  domAppendChild(parent, node);
@@ -18127,6 +18128,7 @@ var Xslt = class {
18127
18128
  XmlParser,
18128
18129
  Xslt,
18129
18130
  domDocumentToXDocument,
18130
- xmlEscapeText
18131
+ xmlEscapeText,
18132
+ xmlTransformedText
18131
18133
  });
18132
18134
  //# sourceMappingURL=index.js.map