xsltUnparsedEntityURIFunction: : the XPath Parser context : the number of arguments
Implement the unparsed-entity-uri() XSLT function string unparsed-entity-uri(string)
Definition at line 549 of file functions.c.
Referenced by xsltRegisterAllFunctions().
{
xmlXPathObjectPtr obj;
xmlChar *str;
if ((nargs != 1) || (ctxt->value == NULL)) {
xsltGenericError(xsltGenericErrorContext,
"unparsed-entity-uri() : expects one string arg\n");
ctxt->error = XPATH_INVALID_ARITY;
return;
}
obj = valuePop(ctxt);
if (obj->type != XPATH_STRING) {
obj = xmlXPathConvertString(obj);
}
str = obj->stringval;
if (str == NULL) {
valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
} else {
xmlEntityPtr entity;
entity = xmlGetDocEntity(ctxt->context->doc, str);
if (entity == NULL) {
valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
} else {
if (entity->URI != NULL)
valuePush(ctxt, xmlXPathNewString(entity->URI));
else
valuePush(ctxt, xmlXPathNewString((const xmlChar *)""));
}
}
xmlXPathFreeObject(obj);
}