OLD | NEW |
1 /* | 1 /* |
2 * templates.c: Implementation of the template processing | 2 * templates.c: Implementation of the template processing |
3 * | 3 * |
4 * Reference: | 4 * Reference: |
5 * http://www.w3.org/TR/1999/REC-xslt-19991116 | 5 * http://www.w3.org/TR/1999/REC-xslt-19991116 |
6 * | 6 * |
7 * See Copyright for the status of this software. | 7 * See Copyright for the status of this software. |
8 * | 8 * |
9 * daniel@veillard.com | 9 * daniel@veillard.com |
10 */ | 10 */ |
11 | 11 |
12 #define IN_LIBXSLT | 12 #define IN_LIBXSLT |
13 #include "libxslt.h" | 13 #include "libxslt.h" |
14 | 14 |
15 #include <string.h> | 15 #include <string.h> |
16 | 16 |
17 #include <libxml/xmlmemory.h> | 17 #include <libxml/xmlmemory.h> |
18 #include <libxml/globals.h> | 18 #include <libxml/globals.h> |
19 #include <libxml/xmlerror.h> | 19 #include <libxml/xmlerror.h> |
20 #include <libxml/tree.h> | 20 #include <libxml/tree.h> |
| 21 #include <libxml/dict.h> |
21 #include <libxml/xpathInternals.h> | 22 #include <libxml/xpathInternals.h> |
22 #include <libxml/parserInternals.h> | 23 #include <libxml/parserInternals.h> |
23 #include "xslt.h" | 24 #include "xslt.h" |
24 #include "xsltInternals.h" | 25 #include "xsltInternals.h" |
25 #include "xsltutils.h" | 26 #include "xsltutils.h" |
26 #include "variables.h" | 27 #include "variables.h" |
27 #include "functions.h" | 28 #include "functions.h" |
28 #include "templates.h" | 29 #include "templates.h" |
29 #include "transform.h" | 30 #include "transform.h" |
30 #include "namespaces.h" | 31 #include "namespaces.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 "Internal error: Failed to evaluate the AVT " | 566 "Internal error: Failed to evaluate the AVT " |
566 "of attribute '%s'.\n", | 567 "of attribute '%s'.\n", |
567 attr->name); | 568 attr->name); |
568 } | 569 } |
569 text->content = xmlStrdup(BAD_CAST ""); | 570 text->content = xmlStrdup(BAD_CAST ""); |
570 } else { | 571 } else { |
571 text->content = val; | 572 text->content = val; |
572 } | 573 } |
573 } else if ((ctxt->internalized) && (target != NULL) && | 574 } else if ((ctxt->internalized) && (target != NULL) && |
574 (target->doc != NULL) && | 575 (target->doc != NULL) && |
575 » » (target->doc->dict == ctxt->dict)) { | 576 » » (target->doc->dict == ctxt->dict) && |
| 577 » » xmlDictOwns(ctxt->dict, value)) { |
576 text->content = (xmlChar *) value; | 578 text->content = (xmlChar *) value; |
577 } else { | 579 } else { |
578 text->content = xmlStrdup(value); | 580 text->content = xmlStrdup(value); |
579 } | 581 } |
580 } | 582 } |
581 } else { | 583 } else { |
582 if (attr->ns) { | 584 if (attr->ns) { |
583 xsltTransformError(ctxt, NULL, attr->parent, | 585 xsltTransformError(ctxt, NULL, attr->parent, |
584 "Internal error: Failed to create attribute '{%s}%s'.\n", | 586 "Internal error: Failed to create attribute '{%s}%s'.\n", |
585 attr->ns->href, attr->name); | 587 attr->ns->href, attr->name); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 "of attribute '%s'.\n", | 752 "of attribute '%s'.\n", |
751 attr->name); | 753 attr->name); |
752 } | 754 } |
753 text->content = xmlStrdup(BAD_CAST ""); | 755 text->content = xmlStrdup(BAD_CAST ""); |
754 goto error; | 756 goto error; |
755 } else { | 757 } else { |
756 text->content = valueAVT; | 758 text->content = valueAVT; |
757 } | 759 } |
758 } else if ((ctxt->internalized) && | 760 } else if ((ctxt->internalized) && |
759 (target->doc != NULL) && | 761 (target->doc != NULL) && |
760 » » (target->doc->dict == ctxt->dict)) | 762 » » (target->doc->dict == ctxt->dict) && |
| 763 » » xmlDictOwns(ctxt->dict, value)) |
761 { | 764 { |
762 text->content = (xmlChar *) value; | 765 text->content = (xmlChar *) value; |
763 } else { | 766 } else { |
764 text->content = xmlStrdup(value); | 767 text->content = xmlStrdup(value); |
765 } | 768 } |
766 if ((copy != NULL) && (text != NULL) && | 769 if ((copy != NULL) && (text != NULL) && |
767 (xmlIsID(copy->doc, copy->parent, copy))) | 770 (xmlIsID(copy->doc, copy->parent, copy))) |
768 xmlAddID(NULL, copy->doc, text->content, copy); | 771 xmlAddID(NULL, copy->doc, text->content, copy); |
769 } | 772 } |
770 | 773 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 */ | 819 */ |
817 xmlNodePtr * | 820 xmlNodePtr * |
818 xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr no
de) { | 821 xsltTemplateProcess(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr no
de) { |
819 if (node == NULL) | 822 if (node == NULL) |
820 return(NULL); | 823 return(NULL); |
821 | 824 |
822 return(0); | 825 return(0); |
823 } | 826 } |
824 | 827 |
825 | 828 |
OLD | NEW |