WebControl to pass XSLT parameters

Before the root template .xsl <xsl: param name = "len " />
conditions used <xsl: if test = "$ len> = position ()"> control flow
to create a new class in .net, extend WebControl class
provides two VS modified in the panel design parameters: feedURL and the MaxLength
        [the Bindable (to true),
        the Category ( "RSS settings")]
        public String feedUrl       
        {
            GET
            {
                return feedUrl;
            }

            sET
            {
                feedUrl = value;
            }
        }

        [the Bindable ( to true),
        the Category ( "RSS settings")]
        public int the MaxLength
        {
            GET
            {
                return len;
            }

            SET
            {
                len = value;
            }
        }
Method
        public getXml the XmlDocument ()
        {
       
            the XmlDocument new new XML = the XmlDocument ();
            XML.load (feedUrl);
            return XML;
        }
acquired RSS document.
Rewriting WebControl Render method
        protected the override void Render (the HtmlTextWriter Output)
        {
            the XsltArgumentList xslArg the XsltArgumentList new new = ();
            xslArg.AddParam("len", "", len);
            XslTransform transform = new XslTransform();
            transform.Load("http://localhost/style/feeds.xsl");
            transform.Transform(getXml(), xslArg, output,null);
           
            //Call base class
            base.Render(output);
            //    output.Write(Text);
        }   
实现向xsl传参,对rss的转换和输出。

Reproduced in: https: //www.cnblogs.com/civ3/archive/2005/09/11/234460.html

Guess you like

Origin blog.csdn.net/weixin_33937913/article/details/93571506