+ nmem = nmem_create();
+ info = nmem_malloc(nmem, sizeof(*info));
+ info->nmem = nmem;
+ info->xsl_parms = nmem_malloc(
+ nmem, (2 * max_parms + 1) * sizeof(*info->xsl_parms));
+
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ const char *name = 0;
+ const char *value = 0;
+ char *qvalue = 0;
+ if (ptr->type != XML_ELEMENT_NODE)
+ continue;
+ if (strcmp((const char *) ptr->name, "param"))
+ {
+ wrbuf_printf(wr_error, "Bad element '%s'"
+ "Expected param.", ptr->name);
+ nmem_destroy(nmem);
+ return 0;
+ }
+ for (attr = ptr->properties; attr; attr = attr->next)
+ {
+ if (!xmlStrcmp(attr->name, BAD_CAST "name") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ name = (const char *) attr->children->content;
+ else if (!xmlStrcmp(attr->name, BAD_CAST "value") &&
+ attr->children && attr->children->type == XML_TEXT_NODE)
+ value = (const char *) attr->children->content;
+ else
+ {
+ wrbuf_printf(wr_error, "Bad attribute '%s'"
+ "Expected name or value.", attr->name);
+ nmem_destroy(nmem);
+ return 0;
+ }
+ }
+ if (!name || !value)
+ {
+ wrbuf_printf(wr_error, "Missing attributes name or value");
+ nmem_destroy(nmem);
+ return 0;
+ }
+ if (no_parms >= max_parms)
+ {
+ wrbuf_printf(wr_error, "Too many parameters given");
+ nmem_destroy(nmem);
+ return 0;
+ }
+
+ qvalue = nmem_malloc(nmem, strlen(value) + 3);
+ strcpy(qvalue, "\'");
+ strcat(qvalue, value);
+ strcat(qvalue, "\'");
+
+ info->xsl_parms[2 * no_parms] = nmem_strdup(nmem, name);
+ info->xsl_parms[2 * no_parms + 1] = qvalue;
+ no_parms++;
+ }
+
+ info->xsl_parms[2 * no_parms] = '\0';
+