How do i progmatically add to xsltExtensions.config Options
warren
Posted: Tuesday, February 19, 2008 4:23:12 PM

Rank: Addict

Joined: 7/19/2006
Posts: 820
Location: Benfleet, Essex, UK
Hello all,
I am in the process of creating a package and would like to know if it is possible to progmatically add my XSLT helper dll file to the xsltExtensions.config file?

If this is possible please could you give me some details on how to achieve this please.

Thanks,
Warren

Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
tim
Posted: Tuesday, February 19, 2008 4:30:45 PM

Rank: Addict

Joined: 2/19/2007
Posts: 819
Location: Belgium
Hi Warren, I think I have some sourcecode that does that, I'll digg it up.

Cheers,
Tim

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
tim
Posted: Tuesday, February 19, 2008 4:37:15 PM

Rank: Addict

Joined: 2/19/2007
Posts: 819
Location: Belgium
Found it.

So first step would be to create a usercontrol that will be loaded ( last step of installing package ).


Code:


private void updateRestExtensions()
        {
            XmlDocument document = new XmlDocument();

           
            document.Load(Server.MapPath("/config/") + "restExtensions.config");

            XmlNode newChild = document.CreateElement("ext");


            XmlAttribute AtAssembly = document.CreateAttribute("assembly");
            AtAssembly.Value = "/bin/xtraUmbracoStarRating";
            newChild.Attributes.Append(AtAssembly);

            XmlAttribute atType = document.CreateAttribute("type");
            atType.Value = "xtraUmbracoStarRating.StarRating";
            newChild.Attributes.Append(atType);

            XmlAttribute atAlias = document.CreateAttribute("alias");
            atAlias.Value = "StarRating";
            newChild.Attributes.Append(atAlias);

            //permission node
            XmlNode permissionNode = document.CreateElement("permission");
            newChild.AppendChild(permissionNode);

            XmlAttribute atMethod = document.CreateAttribute("method");
            atMethod.Value = "update";
            permissionNode.Attributes.Append(atMethod);

            XmlAttribute atAllowAll = document.CreateAttribute("allowAll");
            atAllowAll.Value = "true";
            permissionNode.Attributes.Append(atAllowAll);

            document.DocumentElement.AppendChild(newChild);

            document.Save(Server.MapPath("/config/") + "restExtensions.config");

           
        }



Hope this will get you started

Cheers,
Tim

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
tim
Posted: Tuesday, February 19, 2008 4:39:20 PM

Rank: Addict

Joined: 2/19/2007
Posts: 819
Location: Belgium
This is the full project

Source: http://testing.netcentric.be/TG.Umb.StarRating/xtraUmbracoStarRatingSourceRC1.zip





Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
tim
Posted: Tuesday, February 19, 2008 4:40:10 PM

Rank: Addict

Joined: 2/19/2007
Posts: 819
Location: Belgium
xslt extensions

Code:


private void updatexsltExtensions()
        {
            XmlDocument document = new XmlDocument();


            document.Load(Server.MapPath("/config/") + "xsltExtensions.config");

            XmlNode newChild = document.CreateElement("ext");

            XmlAttribute AtAssembly = document.CreateAttribute("assembly");
            AtAssembly.Value = "/bin/xtraUmbracoStarRating";
            newChild.Attributes.Append(AtAssembly);

            XmlAttribute atType = document.CreateAttribute("type");
            atType.Value = "xtraUmbracoStarRating.StarRating";
            newChild.Attributes.Append(atType);

            XmlAttribute atAlias = document.CreateAttribute("alias");
            atAlias.Value = "StarRating";
            newChild.Attributes.Append(atAlias);

            document.DocumentElement.AppendChild(newChild);

            document.Save(Server.MapPath("/config/") + "xsltExtensions.config");


        }


Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
warren
Posted: Tuesday, February 19, 2008 7:12:38 PM

Rank: Addict

Joined: 7/19/2006
Posts: 820
Location: Benfleet, Essex, UK
Hi Tim,
I have been working on adding this into an installer usercontrol however I am not getting the expected results.

Can you drop me a MSN please, so we can try to resolve this.

Thanks,
Warren

Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.