internal static void ExpectNoArguments(XmlTransformationLogger log, string transformName, string argumentString)
 {
     if (!String.IsNullOrEmpty(argumentString))
     {
         log.LogWarning(SR.XMLTRANSFORMATION_TransformDoesNotExpectArguments, transformName);
     }
 }
        private void PreprocessTransformDocument()
        {
            hasTransformNamespace = false;
            foreach (XmlAttribute attribute in xmlTransformation.SelectNodes("//namespace::*"))
            {
                if (attribute.Value.Equals(TransformNamespace, StringComparison.Ordinal))
                {
                    hasTransformNamespace = true;
                    break;
                }
            }

            if (hasTransformNamespace)
            {
                // This will look for all nodes from our namespace in the document,
                // and do any initialization work
                XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable());
                namespaceManager.AddNamespace("xdt", TransformNamespace);
                XmlNodeList namespaceNodes = xmlTransformation.SelectNodes("//xdt:*", namespaceManager);

                foreach (XmlNode node in namespaceNodes)
                {
                    XmlElement element = node as XmlElement;
                    if (element == null)
                    {
                        Debug.Fail("The XPath for elements returned something that wasn't an element?");
                        continue;
                    }

                    XmlElementContext context = null;
                    try {
                        switch (element.LocalName)
                        {
                        case "Import":
                            context = CreateElementContext(null, element);
                            PreprocessImportElement(context);
                            break;

                        default:
                            logger.LogWarning(element, SR.XMLTRANSFORMATION_UnknownXdtTag, element.Name);
                            break;
                        }
                    }
                    catch (Exception ex) {
                        if (context != null)
                        {
                            ex = WrapException(ex, context);
                        }

                        logger.LogErrorFromException(ex);
                        throw new XmlTransformationException(SR.XMLTRANSFORMATION_FatalTransformSyntaxError, ex);
                    }
                    finally {
                        context = null;
                    }
                }
            }
        }
        internal static void WarnIfMultipleTargets(XmlTransformationLogger log, string transformName, XmlNodeList targetNodes, bool applyTransformToAllTargets)
        {
            Debug.Assert(applyTransformToAllTargets == false);

            if (targetNodes.Count > 1)
            {
                log.LogWarning(SR.XMLTRANSFORMATION_TransformOnlyAppliesOnce, transformName);
            }
        }