OLD | NEW |
1 #define IN_LIBEXSLT | 1 #define IN_LIBEXSLT |
2 #include "libexslt/libexslt.h" | 2 #include "libexslt/libexslt.h" |
3 | 3 |
4 #if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) | 4 #if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) |
5 #include <win32config.h> | 5 #include <win32config.h> |
6 #else | 6 #else |
7 #include "config.h" | 7 #include "config.h" |
8 #endif | 8 #endif |
9 | 9 |
10 #include <libxml/tree.h> | 10 #include <libxml/tree.h> |
(...skipping 28 matching lines...) Expand all Loading... |
39 /* | 39 /* |
40 * SPEC EXSLT: | 40 * SPEC EXSLT: |
41 * "You can also use this function to turn a string into a text | 41 * "You can also use this function to turn a string into a text |
42 * node, which is helpful if you want to pass a string to a | 42 * node, which is helpful if you want to pass a string to a |
43 * function that only accepts a node-set." | 43 * function that only accepts a node-set." |
44 */ | 44 */ |
45 fragment = xsltCreateRVT(tctxt); | 45 fragment = xsltCreateRVT(tctxt); |
46 if (fragment == NULL) { | 46 if (fragment == NULL) { |
47 xsltTransformError(tctxt, NULL, tctxt->inst, | 47 xsltTransformError(tctxt, NULL, tctxt->inst, |
48 "exsltNodeSetFunction: Failed to create a tree fragment.\n"); | 48 "exsltNodeSetFunction: Failed to create a tree fragment.\n"); |
49 » tctxt->state = XSLT_STATE_STOPPED; | 49 » tctxt->state = XSLT_STATE_STOPPED; |
50 return; | 50 return; |
51 } | 51 } |
52 xsltRegisterLocalRVT(tctxt, fragment); | 52 xsltRegisterLocalRVT(tctxt, fragment); |
53 | 53 |
54 strval = xmlXPathPopString (ctxt); | 54 strval = xmlXPathPopString (ctxt); |
55 » | 55 |
56 txt = xmlNewDocText (fragment, strval); | 56 txt = xmlNewDocText (fragment, strval); |
57 xmlAddChild((xmlNodePtr) fragment, txt); | 57 xmlAddChild((xmlNodePtr) fragment, txt); |
58 » obj = xmlXPathNewNodeSet(txt);» | 58 » obj = xmlXPathNewNodeSet(txt); |
59 if (obj == NULL) { | 59 if (obj == NULL) { |
60 xsltTransformError(tctxt, NULL, tctxt->inst, | 60 xsltTransformError(tctxt, NULL, tctxt->inst, |
61 "exsltNodeSetFunction: Failed to create a node set object.\n"); | 61 "exsltNodeSetFunction: Failed to create a node set object.\n"); |
62 tctxt->state = XSLT_STATE_STOPPED; | 62 tctxt->state = XSLT_STATE_STOPPED; |
63 } else { | 63 } else { |
64 /* | 64 /* |
65 * Mark it as a function result in order to avoid garbage | 65 * Mark it as a function result in order to avoid garbage |
66 * collecting of tree fragments | 66 * collecting of tree fragments |
67 */ | 67 */ |
68 xsltExtensionInstructionResultRegister(tctxt, obj); | 68 xsltExtensionInstructionResultRegister(tctxt, obj); |
69 } | 69 } |
70 if (strval != NULL) | 70 if (strval != NULL) |
71 xmlFree (strval); | 71 xmlFree (strval); |
72 » | 72 |
73 valuePush (ctxt, obj); | 73 valuePush (ctxt, obj); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 static void | 77 static void |
78 exsltObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) { | 78 exsltObjectTypeFunction (xmlXPathParserContextPtr ctxt, int nargs) { |
79 xmlXPathObjectPtr obj, ret; | 79 xmlXPathObjectPtr obj, ret; |
80 | 80 |
81 if (nargs != 1) { | 81 if (nargs != 1) { |
82 xmlXPathSetArityError(ctxt); | 82 xmlXPathSetArityError(ctxt); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 EXSLT_COMMON_NAMESPACE, | 128 EXSLT_COMMON_NAMESPACE, |
129 exsltNodeSetFunction); | 129 exsltNodeSetFunction); |
130 xsltRegisterExtModuleFunction((const xmlChar *) "object-type", | 130 xsltRegisterExtModuleFunction((const xmlChar *) "object-type", |
131 EXSLT_COMMON_NAMESPACE, | 131 EXSLT_COMMON_NAMESPACE, |
132 exsltObjectTypeFunction); | 132 exsltObjectTypeFunction); |
133 xsltRegisterExtModuleElement((const xmlChar *) "document", | 133 xsltRegisterExtModuleElement((const xmlChar *) "document", |
134 EXSLT_COMMON_NAMESPACE, | 134 EXSLT_COMMON_NAMESPACE, |
135 (xsltPreComputeFunction) xsltDocumentComp, | 135 (xsltPreComputeFunction) xsltDocumentComp, |
136 (xsltTransformFunction) xsltDocumentElem); | 136 (xsltTransformFunction) xsltDocumentElem); |
137 } | 137 } |
OLD | NEW |