diff --git a/libxslt/xslt.c b/libxslt/xslt.c
index 8bc32a6faaf78e4603eefe77d25e97296445fd57_bGlieHNsdC94c2x0LmM=..88e6139997f8ccbdd8be1f37d230813da7e8a359_bGlieHNsdC94c2x0LmM= 100644
--- a/libxslt/xslt.c
+++ b/libxslt/xslt.c
@@ -6681,6 +6681,9 @@
     }
 #endif /* else of XSLT_REFACTORED */
 
+    if (style->parent == NULL)
+        xsltResolveStylesheetAttributeSet(style);
+
     if (style->errors != 0) {
         /*
         * Detach the doc from the stylesheet; otherwise the doc
@@ -6695,9 +6698,6 @@
         return(-1);
     }
 
-    if (style->parent == NULL)
-        xsltResolveStylesheetAttributeSet(style);
-
     return(0);
 }