Пример #1
0
        /// <summary>
        /// This method has to use the old XSL Processor because of the fact that the
        /// http://www.w3.org/TR/WD-xsl namespace is unsupported.
        ///
        /// The simplest way was to use the old xsl instead of re-inventing the wheel.
        /// I could not find a way to easily fully convert this to XSLT 1.0 due to
        /// the lack of namespace and cdata 'selectability'.
        ///
        /// This brings back memories :)
        /// </summary>
        /// <param name="xmlToRender">the xml string to render</param>
        /// <returns>HTML string</returns>
        internal static string Render(string xmlToRender)
        {
            XSLTemplate             oXSLT;
            FreeThreadedDOMDocument oStyleSheet;
            IXSLProcessor           oXSLTProc;
            DOMDocument             oXMLSource;

            try
            {
                oXSLT       = new XSLTemplate();
                oStyleSheet = new FreeThreadedDOMDocument();
                oXMLSource  = new DOMDocument();

                oStyleSheet.async = false;
                oStyleSheet.loadXML(XmlRender.XMLToHTML);

                oXSLT.stylesheet = oStyleSheet;

                oXSLTProc = oXSLT.createProcessor();

                oXMLSource.async = false;
                oXMLSource.loadXML(xmlToRender);
                oXSLTProc.input = oXMLSource;

                oXSLTProc.transform();

                return(oXSLTProc.output.ToString());
            }
            catch (Exception e)
            {
                return(e.Message);
            }
            finally
            {
                oXSLT       = null;
                oStyleSheet = null;
                oXMLSource  = null;
                oXSLTProc   = null;
            }
        }
Пример #2
0
        /// <summary>
        /// This method has to use the old XSL Processor because of the fact that the
        /// http://www.w3.org/TR/WD-xsl namespace is unsupported.
        ///
        /// The simplest way was to use the old xsl instead of re-inventing the wheel.
        /// I could not find a way to easily fully convert this to XSLT 1.0 due to 
        /// the lack of namespace and cdata 'selectability'.
        ///
        /// This brings back memories :)
        /// </summary>
        /// <param name="xmlToRender">the xml string to render</param>
        /// <returns>HTML string</returns>
        internal static string Render(string xmlToRender)
        {
            XSLTemplate oXSLT;
            FreeThreadedDOMDocument oStyleSheet;
            IXSLProcessor oXSLTProc;
            DOMDocument oXMLSource;

            try
            {
                oXSLT = new XSLTemplate();
                oStyleSheet = new FreeThreadedDOMDocument();
                oXMLSource = new DOMDocument();

                oStyleSheet.async = false;
                oStyleSheet.loadXML(XmlRender.XMLToHTML);

                oXSLT.stylesheet = oStyleSheet;

                oXSLTProc = oXSLT.createProcessor();

                oXMLSource.async = false;
                oXMLSource.loadXML(xmlToRender);
                oXSLTProc.input = oXMLSource;

                oXSLTProc.transform();

                return oXSLTProc.output.ToString();
            }
            catch (Exception e)
            {
                return e.Message;
            }
            finally
            {
                oXSLT = null;
                oStyleSheet = null;
                oXMLSource = null;
                oXSLTProc = null;
            }
        }
Пример #3
0
 public string transformNode (FreeThreadedDOMDocument doc)
 {
     return string.Empty;
 }