kamagra how much to take

Example XSL Transformation

If you have an XSL document that you wish to apply to you webpart returns, you need a method to apply the XSL transformation.

  1. public string XslTransform(XmlDocument XmlDoc, string xslPath)
  2. {
  3.         System.Xml.Xsl.XslTransform exampleTransform = null;
  4.         StringBuilder exampleBuilder = new StringBuilder(0x2710);
  5.         TextWriter exampleWriter = new StringWriter(exampleBuilder);
  6.         try
  7.         {
  8.                 if (this.Page.Cache.Get(xslPath) is System.Xml.Xsl.XslTransform)
  9.                 {
  10.                         exampleTransform = this.Page.Cache.Get("Xsl") as System.Xml.Xsl.XslTransform;
  11.                 }
  12.         }
  13.         catch
  14.         {
  15.         }
  16.         if (exampleTransform == null)
  17.         {
  18.                 XmlDocument exampleDocument = new XmlDocument();
  19.                 XmlUrlResolver exampleResolver = new XmlUrlResolver();
  20.                 exampleResolver.Credentials = CredentialCache.DefaultCredentials;
  21.                 exampleDocument.XmlResolver = exampleResolver;
  22.                 exampleDocument.Load(xslPath);
  23.                 exampleTransform = new System.Xml.Xsl.XslTransform();
  24.                 exampleTransform.Load(exampleDocument.CreateNavigator(), exampleResolver, null);
  25.                 try
  26.                 {
  27.                         this.Page.Cache.Insert(xslPath, exampleTransform);
  28.                 }
  29.                 catch
  30.                 {
  31.                 }
  32.         }
  33.         exampleTransform.Transform(XmlDoc.CreateNavigator(), null, exampleWriter, null);
  34.         exampleWriter.Close();
  35.         return exampleBuilder.ToString();
  36. }
Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>