Exemplo n.º 1
0
        public void GenerateLiftingXSLT()
        {
            SaveFileDialog D = new SaveFileDialog();

            D.Filter          = "XSLT Stylesheet|*.xslt";
            D.CheckPathExists = true;
            D.Title           = "Save Lifting XSLT as...";
            if (D.ShowDialog() != true)
            {
                return;
            }

            foreach (PSMSuperordinateComponent C in (controller.Diagram as PSMDiagram).Roots)
            {
                if (C is PSMClass)
                {
                    string newname = GetTemplateName((C as PSMClass).ElementName);
                    RDFElement.Add(new XElement(nsxsl + "for-each",
                                                new XAttribute("select", Namespaces[nsproject] + ":" + (C as PSMClass).ElementName),
                                                new XElement(nsxsl + "call-template",
                                                             new XAttribute("name", newname))));
                    ProcessClass(C as PSMClass, newname);
                }
            }

            foreach (KeyValuePair <XNamespace, string> P in Namespaces)
            {
                Stylesheet.Add(new XAttribute(XNamespace.Xmlns + P.Value, P.Key.NamespaceName));
            }

            Stylesheet_doc.Save(D.FileName);
        }
Exemplo n.º 2
0
        public void GenerateLoweringXSLT()
        {
            SaveFileDialog D = new SaveFileDialog();

            D.Filter          = "XSLT Stylesheet|*.xslt";
            D.CheckPathExists = true;
            D.Title           = "Save Lowering XSLT as...";
            if (D.ShowDialog() != true)
            {
                return;
            }

            foreach (PSMSuperordinateComponent C in (controller.Diagram as PSMDiagram).Roots)
            {
                if (C is PSMClass)
                {
                    string XPath   = Namespaces[nsrdf] + ":Description[descendant::" + Namespaces[nsrdfs] + ":Class[@" + Namespaces[nsrdf] + ":resource='" + (C as PSMClass).RepresentedClass.OntologyEquivalent + "'] and not(@" + Namespaces[nsrdf] + ":about = //@" + Namespaces[nsrdf] + ":resource)]/@" + Namespaces[nsrdf] + ":about";
                    string newname = GetTemplateName((C as PSMClass).RepresentedClass.OntologyEquivalent);
                    rootTemplate.Add(new XElement(nsxsl + "call-template",
                                                  new XAttribute("name", newname),
                                                  new XElement(nsxsl + "with-param",
                                                               new XAttribute("name", "id"),
                                                               new XAttribute("select", XPath))));
                    ProcessClass(C as PSMClass, newname);
                }
            }

            foreach (KeyValuePair <XNamespace, string> P in Namespaces)
            {
                Stylesheet.Add(new XAttribute(XNamespace.Xmlns + P.Value, P.Key.NamespaceName));
            }

            Stylesheet_doc.Save(D.FileName);
        }