Example #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     //new XPathDocument
     XPathDocument doc = new XPathDocument("books.xml");
     //new XslTransform
     XslCompiledTransform trans = new XslCompiledTransform();
     trans.Load("booksarg.xsl");
     //new XmlTextWriter since we are creating a new xml document
     XmlWriter xw = new XmlTextWriter("argSample.xml", null);
     //create the XslArgumentList and new BookUtils object
     XsltArgumentList argBook = new XsltArgumentList();
     BookUtils bu = new BookUtils();
     //this tells the argumentlist about BookUtils
     argBook.AddExtensionObject("urn:XslSample", bu);
     //new XPathNavigator
     XPathNavigator nav = doc.CreateNavigator();
     //do the transform
     trans.Transform(nav, argBook, xw);
     xw.Close();
     webBrowser1.Navigate(AppDomain.CurrentDomain.BaseDirectory + "argSample.xml");
 }
Example #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            //new XPathDocument
            XPathDocument doc = new XPathDocument("books.xml");
            //new XslTransform
            XslCompiledTransform trans = new XslCompiledTransform();

            trans.Load("booksarg.xsl");
            //new XmlTextWriter since we are creating a new xml document
            XmlWriter xw = new XmlTextWriter("argSample.xml", null);
            //create the XslArgumentList and new BookUtils object
            XsltArgumentList argBook = new XsltArgumentList();
            BookUtils        bu      = new BookUtils();

            //this tells the argumentlist about BookUtils
            argBook.AddExtensionObject("urn:XslSample", bu);
            //new XPathNavigator
            XPathNavigator nav = doc.CreateNavigator();

            //do the transform
            trans.Transform(nav, argBook, xw);
            xw.Close();
            webBrowser1.Navigate(AppDomain.CurrentDomain.BaseDirectory + "argSample.xml");
        }