OLD | NEW |
1 /* | 1 /* |
2 * transform.c: Implementation of the XSL Transformation 1.0 engine | 2 * transform.c: Implementation of the XSL Transformation 1.0 engine |
3 * transform part, i.e. applying a Stylesheet to a document | 3 * transform part, i.e. applying a Stylesheet to a document |
4 * | 4 * |
5 * References: | 5 * References: |
6 * http://www.w3.org/TR/1999/REC-xslt-19991116 | 6 * http://www.w3.org/TR/1999/REC-xslt-19991116 |
7 * | 7 * |
8 * Michael Kay "XSLT Programmer's Reference" pp 637-643 | 8 * Michael Kay "XSLT Programmer's Reference" pp 637-643 |
9 * Writing Multiple Output Files | 9 * Writing Multiple Output Files |
10 * | 10 * |
(...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 ctxt->insert = oldInsert; | 2679 ctxt->insert = oldInsert; |
2680 } else { | 2680 } else { |
2681 /* | 2681 /* |
2682 * Execute the handler-callback. | 2682 * Execute the handler-callback. |
2683 */ | 2683 */ |
2684 #ifdef WITH_XSLT_DEBUG_PROCESS | 2684 #ifdef WITH_XSLT_DEBUG_PROCESS |
2685 XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(x
sltGenericDebugContext, | 2685 XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(x
sltGenericDebugContext, |
2686 "xsltApplySequenceConstructor: extension construct %s\n"
, | 2686 "xsltApplySequenceConstructor: extension construct %s\n"
, |
2687 cur->name)); | 2687 cur->name)); |
2688 #endif | 2688 #endif |
| 2689 /* |
| 2690 * Disable the xsltCopyTextString optimization for |
| 2691 * extension elements. Extensions could append text using |
| 2692 * xmlAddChild which will free the buffer pointed to by |
| 2693 * 'lasttext'. This buffer could later be reallocated with |
| 2694 * a different size than recorded in 'lasttsize'. See bug |
| 2695 * #777432. |
| 2696 */ |
| 2697 if (cur->psvi == xsltExtMarker) { |
| 2698 ctxt->lasttext = NULL; |
| 2699 } |
| 2700 |
2689 ctxt->insert = insert; | 2701 ctxt->insert = insert; |
2690 | 2702 |
2691 func(ctxt, contextNode, cur, cur->psvi); | 2703 func(ctxt, contextNode, cur, cur->psvi); |
2692 | 2704 |
2693 /* | 2705 /* |
2694 * Cleanup temporary tree fragments. | 2706 * Cleanup temporary tree fragments. |
2695 */ | 2707 */ |
2696 if (oldLocalFragmentTop != ctxt->localRVT) | 2708 if (oldLocalFragmentTop != ctxt->localRVT) |
2697 xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); | 2709 xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); |
2698 | 2710 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2862 "xsltApplySequenceConstructor: failed to find extension
%s\n", | 2874 "xsltApplySequenceConstructor: failed to find extension
%s\n", |
2863 cur->name); | 2875 cur->name); |
2864 } | 2876 } |
2865 } else { | 2877 } else { |
2866 #ifdef WITH_XSLT_DEBUG_PROCESS | 2878 #ifdef WITH_XSLT_DEBUG_PROCESS |
2867 XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltG
enericDebugContext, | 2879 XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATE,xsltGenericDebug(xsltG
enericDebugContext, |
2868 "xsltApplySequenceConstructor: extension construct %s\n", | 2880 "xsltApplySequenceConstructor: extension construct %s\n", |
2869 cur->name)); | 2881 cur->name)); |
2870 #endif | 2882 #endif |
2871 | 2883 |
| 2884 /* |
| 2885 * Disable the xsltCopyTextString optimization for |
| 2886 * extension elements. Extensions could append text using |
| 2887 * xmlAddChild which will free the buffer pointed to by |
| 2888 * 'lasttext'. This buffer could later be reallocated with |
| 2889 * a different size than recorded in 'lasttsize'. See bug |
| 2890 * #777432. |
| 2891 */ |
| 2892 if (cur->psvi == xsltExtMarker) { |
| 2893 ctxt->lasttext = NULL; |
| 2894 } |
| 2895 |
2872 ctxt->insert = insert; | 2896 ctxt->insert = insert; |
2873 | 2897 |
2874 function(ctxt, contextNode, cur, cur->psvi); | 2898 function(ctxt, contextNode, cur, cur->psvi); |
2875 /* | 2899 /* |
2876 * Cleanup temporary tree fragments. | 2900 * Cleanup temporary tree fragments. |
2877 */ | 2901 */ |
2878 if (oldLocalFragmentTop != ctxt->localRVT) | 2902 if (oldLocalFragmentTop != ctxt->localRVT) |
2879 xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); | 2903 xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); |
2880 | 2904 |
2881 ctxt->insert = oldInsert; | 2905 ctxt->insert = oldInsert; |
(...skipping 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5614 ************************************************************************/ | 5638 ************************************************************************/ |
5615 | 5639 |
5616 #ifdef XSLT_GENERATE_HTML_DOCTYPE | 5640 #ifdef XSLT_GENERATE_HTML_DOCTYPE |
5617 typedef struct xsltHTMLVersion { | 5641 typedef struct xsltHTMLVersion { |
5618 const char *version; | 5642 const char *version; |
5619 const char *public; | 5643 const char *public; |
5620 const char *system; | 5644 const char *system; |
5621 } xsltHTMLVersion; | 5645 } xsltHTMLVersion; |
5622 | 5646 |
5623 static xsltHTMLVersion xsltHTMLVersions[] = { | 5647 static xsltHTMLVersion xsltHTMLVersions[] = { |
| 5648 { "5", NULL, "about:legacy-compat" }, |
5624 { "4.01frame", "-//W3C//DTD HTML 4.01 Frameset//EN", | 5649 { "4.01frame", "-//W3C//DTD HTML 4.01 Frameset//EN", |
5625 "http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd"}, | 5650 "http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd"}, |
5626 { "4.01strict", "-//W3C//DTD HTML 4.01//EN", | 5651 { "4.01strict", "-//W3C//DTD HTML 4.01//EN", |
5627 "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd"}, | 5652 "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd"}, |
5628 { "4.01trans", "-//W3C//DTD HTML 4.01 Transitional//EN", | 5653 { "4.01trans", "-//W3C//DTD HTML 4.01 Transitional//EN", |
5629 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"}, | 5654 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"}, |
5630 { "4.01", "-//W3C//DTD HTML 4.01 Transitional//EN", | 5655 { "4.01", "-//W3C//DTD HTML 4.01 Transitional//EN", |
5631 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"}, | 5656 "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"}, |
5632 { "4.0strict", "-//W3C//DTD HTML 4.01//EN", | 5657 { "4.0strict", "-//W3C//DTD HTML 4.01//EN", |
5633 "http://www.w3.org/TR/html4/strict.dtd"}, | 5658 "http://www.w3.org/TR/html4/strict.dtd"}, |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6430 XSLT_NAMESPACE, | 6455 XSLT_NAMESPACE, |
6431 (xsltTransformFunction) xsltDebug); | 6456 (xsltTransformFunction) xsltDebug); |
6432 xsltRegisterExtElement(ctxt, (const xmlChar *) "otherwise", | 6457 xsltRegisterExtElement(ctxt, (const xmlChar *) "otherwise", |
6433 XSLT_NAMESPACE, | 6458 XSLT_NAMESPACE, |
6434 (xsltTransformFunction) xsltDebug); | 6459 (xsltTransformFunction) xsltDebug); |
6435 xsltRegisterExtElement(ctxt, (const xmlChar *) "fallback", | 6460 xsltRegisterExtElement(ctxt, (const xmlChar *) "fallback", |
6436 XSLT_NAMESPACE, | 6461 XSLT_NAMESPACE, |
6437 (xsltTransformFunction) xsltDebug); | 6462 (xsltTransformFunction) xsltDebug); |
6438 | 6463 |
6439 } | 6464 } |
OLD | NEW |