protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            this.options = new TransformOptions();

            this.options.Accordion = this.Accordion;
            this.options.ContainerTag = this.ContainerTag ?? CONTROL_TAG;
            this.options.LayoutName = this.LayoutName ?? DEFAULT_LAYOUT;
            this.options.PersistExpandedState = this.PersistSectionsState;
            this.options.StaticHost = this.StaticHost ?? string.Empty;

            layout.Transform(options);
        }
        public void Transform(TransformOptions options)
        {
            XslCompiledTransform transform = new XslCompiledTransform();

            var assembly = System.Reflection.Assembly.GetExecutingAssembly();

            Stream ins = null;

            IEnumerable<string> filter = assembly.GetManifestResourceNames().Where(x => x.EndsWith("transform.xsl"));

            if (filter.Any()) {

                ins = assembly.GetManifestResourceStream((string)filter.First());
            }

            if (ins == null)
                throw new Exception("transform.xsl stream not found");

            using (XmlReader styleReader = XmlReader.Create(ins))
            {
                transform.Load(styleReader);
            }

            //_docLayout.Save(_layoutDirectory + "\\output.xml");

            XsltArgumentList args = new XsltArgumentList();

            args.AddParam("persistState", string.Empty, options.PersistExpandedState);
            args.AddParam("accordion", string.Empty, options.Accordion);
            args.AddParam("staticHost", string.Empty, options.StaticHost);

            #if DEBUG
            args.AddParam("isDevMode", string.Empty, true);
            #endif

            MemoryStream ms = new MemoryStream();
            transform.Transform(_docLayout, args, ms);
            ms.Position = 0;

            using (StreamReader rd = new StreamReader(ms))
            {
                _transformedmarkup = rd.ReadToEnd();
            }

            System.Web.HttpContext.Current.Cache.Insert(GetRenderedLayoutCacheKey(_layoutName), _transformedmarkup);
        }