| OLD | NEW |
| 1 /* | 1 /* |
| 2 * functions.c: Implementation of the XSLT extra functions | 2 * functions.c: Implementation of the XSLT extra functions |
| 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 * Bjorn Reese <breese@users.sourceforge.net> for number formatting | 10 * Bjorn Reese <breese@users.sourceforge.net> for number formatting |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 xmlChar *prefix, *name; | 806 xmlChar *prefix, *name; |
| 807 const xmlChar *nsURI = NULL; | 807 const xmlChar *nsURI = NULL; |
| 808 xsltTransformContextPtr tctxt; | 808 xsltTransformContextPtr tctxt; |
| 809 | 809 |
| 810 if (nargs != 1) { | 810 if (nargs != 1) { |
| 811 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, | 811 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, |
| 812 "element-available() : expects one string arg\n"); | 812 "element-available() : expects one string arg\n"); |
| 813 ctxt->error = XPATH_INVALID_ARITY; | 813 ctxt->error = XPATH_INVALID_ARITY; |
| 814 return; | 814 return; |
| 815 } | 815 } |
| 816 xmlXPathStringFunction(ctxt, 1); |
| 816 if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { | 817 if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { |
| 817 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, | 818 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, |
| 818 "element-available() : invalid arg expecting a string\n"); | 819 "element-available() : invalid arg expecting a string\n"); |
| 819 ctxt->error = XPATH_INVALID_TYPE; | 820 ctxt->error = XPATH_INVALID_TYPE; |
| 820 return; | 821 return; |
| 821 } | 822 } |
| 822 obj = valuePop(ctxt); | 823 obj = valuePop(ctxt); |
| 823 tctxt = xsltXPathGetTransformContext(ctxt); | 824 tctxt = xsltXPathGetTransformContext(ctxt); |
| 824 if (tctxt == NULL) { | 825 if (tctxt == NULL) { |
| 825 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, | 826 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 xmlXPathObjectPtr obj; | 872 xmlXPathObjectPtr obj; |
| 872 xmlChar *prefix, *name; | 873 xmlChar *prefix, *name; |
| 873 const xmlChar *nsURI = NULL; | 874 const xmlChar *nsURI = NULL; |
| 874 | 875 |
| 875 if (nargs != 1) { | 876 if (nargs != 1) { |
| 876 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, | 877 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, |
| 877 "function-available() : expects one string arg\n"); | 878 "function-available() : expects one string arg\n"); |
| 878 ctxt->error = XPATH_INVALID_ARITY; | 879 ctxt->error = XPATH_INVALID_ARITY; |
| 879 return; | 880 return; |
| 880 } | 881 } |
| 882 xmlXPathStringFunction(ctxt, 1); |
| 881 if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { | 883 if ((ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) { |
| 882 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, | 884 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, |
| 883 "function-available() : invalid arg expecting a string\n"); | 885 "function-available() : invalid arg expecting a string\n"); |
| 884 ctxt->error = XPATH_INVALID_TYPE; | 886 ctxt->error = XPATH_INVALID_TYPE; |
| 885 return; | 887 return; |
| 886 } | 888 } |
| 887 obj = valuePop(ctxt); | 889 obj = valuePop(ctxt); |
| 888 | 890 |
| 889 name = xmlSplitQName2(obj->stringval, &prefix); | 891 name = xmlSplitQName2(obj->stringval, &prefix); |
| 890 if (name == NULL) { | 892 if (name == NULL) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 xsltFormatNumberFunction); | 966 xsltFormatNumberFunction); |
| 965 xmlXPathRegisterFunc(ctxt, (const xmlChar *) "generate-id", | 967 xmlXPathRegisterFunc(ctxt, (const xmlChar *) "generate-id", |
| 966 xsltGenerateIdFunction); | 968 xsltGenerateIdFunction); |
| 967 xmlXPathRegisterFunc(ctxt, (const xmlChar *) "system-property", | 969 xmlXPathRegisterFunc(ctxt, (const xmlChar *) "system-property", |
| 968 xsltSystemPropertyFunction); | 970 xsltSystemPropertyFunction); |
| 969 xmlXPathRegisterFunc(ctxt, (const xmlChar *) "element-available", | 971 xmlXPathRegisterFunc(ctxt, (const xmlChar *) "element-available", |
| 970 xsltElementAvailableFunction); | 972 xsltElementAvailableFunction); |
| 971 xmlXPathRegisterFunc(ctxt, (const xmlChar *) "function-available", | 973 xmlXPathRegisterFunc(ctxt, (const xmlChar *) "function-available", |
| 972 xsltFunctionAvailableFunction); | 974 xsltFunctionAvailableFunction); |
| 973 } | 975 } |
| OLD | NEW |