33#define WITH_XSLT_DEBUG_ATTRIBUTES
35#define WITH_XSLT_DEBUG_ATTRIBUTES
45#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
48#define IS_BLANK_NODE(n) \
49 (((n)->type == XML_TEXT_NODE) && (xsltIsBlank((n)->content)))
51#define ATTRSET_UNRESOLVED 0
52#define ATTRSET_RESOLVING 1
53#define ATTRSET_RESOLVED 2
119 "xsltNewAttrElem : malloc failed\n");
200 "xsltNewUseAttrSet : malloc failed\n");
204 cur->ncname = ncname;
258 if ((
cur->ncname == ncname) && (
cur->ns ==
ns))
284 "xsltNewAttrSet : malloc failed\n");
321 while (old !=
NULL) {
331 if ((curComp->
name == oldComp->
name) &&
332 (curComp->
ns == oldComp->
ns)) {
382 "xsl:attribute-set : name is missing\n");
388 if (xmlValidateQName(
value, 0)) {
390 "xsl:attribute-set : The name '%s' is not a valid QName.\n",
404 "xsl:attribute-set : No namespace found for QName '%s:%s'\n",
413#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
415 "creating attribute set table\n");
441 if ((
child->type != XML_ELEMENT_NODE) ||
445 if (
child->type == XML_ELEMENT_NODE)
447 "xsl:attribute-set : unexpected child %s\n",
451 "xsl:attribute-set : child of unexpected type\n");
454 "xsl:attribute-set : unexpected child xsl:%s\n",
457#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
459 "add attribute to list %s\n", ncname);
463#ifdef XSLT_REFACTORED
464 xsltParseSequenceConstructor(XSLT_CCTXT(
style),
472 "xsl:attribute-set : internal error, attribute %s not "
473 "compiled\n",
child->name);
488 const xmlChar *curval, *endval;
490 while (*curval != 0) {
495 while ((*endval != 0) && (!
IS_BLANK(*endval))) endval++;
502#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
504 "xsl:attribute-set : %s adds use %s\n", ncname, curval);
507 if (xmlValidateQName(curval, 0)) {
509 "xsl:attribute-set : The name '%s' in "
510 "use-attribute-sets is not a valid QName.\n", curval);
517 if (prefix2 !=
NULL) {
518 xmlNsPtr ns2 = xmlSearchNs(
style->doc,
cur, prefix2);
521 "xsl:attribute-set : No namespace found for QName "
522 "'%s:%s' in use-attribute-sets\n",
539#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
541 "updated attribute list %s\n", ncname);
561 while (use !=
NULL) {
567 if (
cur->attributeSets) {
610 "xsl:attribute-set : use-attribute-sets recursion detected"
618 "xsl:attribute-set : use-attribute-sets maximum recursion "
619 "depth exceeded on %s\n",
name);
631 if (
cur->attributeSets !=
NULL) {
635#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
637 "xsl:attribute-set : merging import for %s\n",
name);
671 if (
style != topStyle)
679 if (
style != topStyle) {
686 "xsl:attribute-set : internal error, can't move imported "
687 " attribute set %s\n",
name);
705#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
707 "Resolving attribute sets references\n");
713 if (
cur->attributeSets !=
NULL) {
715#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
717 "creating attribute set table\n");
749 xmlNodePtr contextNode,
753#ifdef XSLT_REFACTORED
754 xsltStyleItemAttributePtr comp =
755 (xsltStyleItemAttributePtr) castedComp;
759 xmlNodePtr targetElem;
766 if ((ctxt ==
NULL) || (contextNode ==
NULL) || (inst ==
NULL) ||
767 (inst->type != XML_ELEMENT_NODE) )
791 "Internal error in xsltAttribute(): "
792 "The XSLT 'attribute' instruction was not compiled.\n");
809 targetElem = ctxt->
insert;
810 if (targetElem->type != XML_ELEMENT_NODE)
823 if (targetElem->children !=
NULL) {
829 "xsl:attribute: Cannot add attributes to an "
830 "element if children have been already added "
831 "to the element.\n");
845 if (comp->name ==
NULL) {
851 "xsl:attribute: The attribute 'name' is missing.\n");
854 if (xmlValidateQName(prop, 0)) {
856 "xsl:attribute: The effective name '%s' is not a "
857 "valid QName.\n", prop);
866 "xsl:attribute: The effective name 'xmlns' is not allowed.\n");
877#ifdef XSLT_REFACTORED
895 if (comp->ns !=
NULL) {
899 if (comp->ns[0] != 0)
917 if ((tmpNsName !=
NULL) && (tmpNsName[0] != 0))
924 "xsl:attribute: Namespace http://www.w3.org/2000/xmlns/ "
941 ns = xmlSearchNs(inst->doc, inst,
prefix);
948 "xsl:attribute: The QName '%s:%s' has no "
949 "namespace binding in scope in the stylesheet; "
950 "this is an error, since the namespace was not "
951 "specified by the instruction itself.\n",
prefix,
name);
972 if (nsName !=
NULL) {
976 ns = xsltTreeAcquireStoredNs(some doc, nsName,
prefix);
981 if (nsName !=
NULL) {
1006 "Namespace fixup error: Failed to acquire an in-scope "
1007 "namespace binding for the generated attribute '{%s}%s'.\n",
1016 if (inst->children ==
NULL) {
1022 }
else if ((inst->children->next ==
NULL) &&
1023 ((inst->children->type == XML_TEXT_NODE) ||
1024 (inst->children->type == XML_CDATA_SECTION_NODE)))
1041 copyTxt = xmlNewText(
NULL);
1042 if (copyTxt ==
NULL)
1048 copyTxt->content = inst->children->content;
1060 copyTxt = xmlNewText(inst->children->content);
1061 if (copyTxt ==
NULL)
1064 attr->children =
attr->last = copyTxt;
1065 copyTxt->parent = (xmlNodePtr)
attr;
1066 copyTxt->doc =
attr->doc;
1079 if ((copyTxt->content !=
NULL) &&
1124 const xmlChar *curstr, *endstr;
1128 if (attrSets ==
NULL) {
1135 if (inst->type == XML_ATTRIBUTE_NODE) {
1136 if ( ((xmlAttrPtr) inst)->children !=
NULL)
1137 attrSets = ((xmlAttrPtr) inst)->children->content;
1140 if (attrSets ==
NULL) {
1152 while (*curstr != 0) {
1158 while ((*endstr != 0) && (!
IS_BLANK(*endstr)))
1165#ifdef WITH_XSLT_DEBUG_ATTRIBUTES
1167 "apply attribute set %s\n", curstr);
1170 if (xmlValidateQName(curstr, 0)) {
1172 "The name '%s' in use-attribute-sets is not a valid "
1173 "QName.\n", curstr);
1179 ns = xmlSearchNs(inst->doc, inst,
prefix);
1182 "use-attribute-set : No namespace found for QName "
1183 "'%s:%s'\n",
prefix, ncname);
void xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst)
static void xsltFreeAttrElem(xsltAttrElemPtr attr)
static xsltAttrElemPtr xsltAddAttrElemList(xsltAttrElemPtr list, xmlNodePtr attr)
#define ATTRSET_RESOLVING
void xsltResolveStylesheetAttributeSet(xsltStylesheetPtr style)
static void xsltFreeUseAttrSet(xsltUseAttrSetPtr use)
static void xsltFreeAttrElemList(xsltAttrElemPtr list)
xsltAttrSet * xsltAttrSetPtr
static xsltUseAttrSetPtr xsltAddUseAttrSetList(xsltUseAttrSetPtr list, const xmlChar *ncname, const xmlChar *ns)
static void xsltFreeAttrSet(xsltAttrSetPtr set)
void xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur)
static void xsltFreeAttributeSetsEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
static xsltUseAttrSetPtr xsltNewUseAttrSet(const xmlChar *ncname, const xmlChar *ns)
xsltUseAttrSet * xsltUseAttrSetPtr
void xsltApplyAttributeSet(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, const xmlChar *attrSets)
static void xsltResolveUseAttrSets(xsltAttrSetPtr set, xsltStylesheetPtr topStyle, int depth)
static void xsltResolveSASCallback(void *payload, void *data, const xmlChar *name, const xmlChar *ns, ATTRIBUTE_UNUSED const xmlChar *ignored)
static void xsltResolveAttrSet(xsltAttrSetPtr set, xsltStylesheetPtr topStyle, xsltStylesheetPtr style, const xmlChar *name, const xmlChar *ns, int depth)
static void xsltFreeUseAttrSetList(xsltUseAttrSetPtr list)
static void xsltMergeAttrSets(xsltAttrSetPtr set, xsltAttrSetPtr other)
void xsltAttribute(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
static xsltAttrSetPtr xsltNewAttrSet(void)
static xsltAttrElemPtr xsltNewAttrElem(xmlNodePtr attr)
xsltAttrSetContext * xsltAttrSetContextPtr
void xsltFreeAttributeSetsHashes(xsltStylesheetPtr style)
xsltAttrElem * xsltAttrElemPtr
GLint GLint GLsizei GLsizei GLsizei depth
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
xmlNsPtr xsltGetSpecialNamespace(xsltTransformContextPtr ctxt, xmlNodePtr invocNode, const xmlChar *nsName, const xmlChar *nsPrefix, xmlNodePtr target)
XMLPUBVAR const xmlChar xmlStringTextNoenc[]
static unsigned __int64 next
const xmlChar * xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
void xmlHashFree(xmlHashTablePtr hash, xmlHashDeallocator dealloc)
void * xmlHashLookup2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2)
int xmlHashRemoveEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, xmlHashDeallocator dealloc)
xmlHashTablePtr xmlHashCreate(int size)
void xmlHashScanFull(xmlHashTablePtr hash, xmlHashScannerFull scan, void *data)
int xmlHashAddEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, void *payload)
struct _xsltAttrElem * next
xsltStylesheetPtr topStyle
xsltUseAttrSetPtr useAttrSets
xmlHashTablePtr attributeSets
struct _xsltUseAttrSet * next
xmlChar * xsltEvalAttrValueTemplate(xsltTransformContextPtr ctxt, xmlNodePtr inst, const xmlChar *name, const xmlChar *ns)
xmlChar * xsltEvalTemplateString(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst)
Character const *const prefix
XMLPUBFUN xmlIDPtr xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value, xmlAttrPtr attr)
XMLPUBFUN int xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr)
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
XMLPUBFUN xmlChar * xmlStrdup(const xmlChar *cur)
xsltStylePreComp * xsltStylePreCompPtr
void xsltParseTemplateContent(xsltStylesheetPtr style, xmlNodePtr templ)
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
xmlGenericErrorFunc xsltGenericError
xmlGenericErrorFunc xsltGenericDebug
void * xsltGenericDebugContext
void * xsltGenericErrorContext
const xmlChar * xsltSplitQName(xmlDictPtr dict, const xmlChar *name, const xmlChar **prefix)
#define IS_XSLT_NAME(n, val)