Hi everyone, is there a straight forward way of accessing the settings in a custom config file or will I have to create a .net assembly to return the values?
Thanks Spider! that's a lot covered but I'd also like to access settings like ConfigurationManager.AppSettings[] in the web.config file. Would you know how I could achieve this?
Haven't found the perfect resolution but something close.
I have yet to figure out if I can access the web.config settings directly from XSLT but I've resolved the issue by adding the .net extension which returns the key values.
When I try doing something similar to your example, I get an error saying 'The variable or parameter 'string' is either not defined or it is out of scope.'
Accessing config settings in XSLT
Hi everyone, is there a straight forward way of accessing the settings in a custom config file or will I have to create a .net assembly to return the values?
Thanks in advance!
You can inject some .NET code into your XSLT like so:
[code]
[/code]
Thanks Spider! that's a lot covered but I'd also like to access settings like ConfigurationManager.AppSettings[] in the web.config file. Would you know how I could achieve this?
Thanks in advance!
Haven't found the perfect resolution but something close.
I have yet to figure out if I can access the web.config settings directly from XSLT but I've resolved the issue by adding the .net extension which returns the key values.
Here is how i have done it:
[code]
]>
<>
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
xmlns:yourprefix="urn:my-scripts"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltStrings">
When I try doing something similar to your example, I get an error saying 'The variable or parameter 'string' is either not defined or it is out of scope.'
Is the value you are trying to retrieve in the appsettings section of the web.config?
Can you post your whole script here and I'll take a look?
Hi Spider,
this is the full xslt file.
[code]
]>
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:search="urn:search"
xmlns:searchTest="urn:testscripts"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:RegularExpression="urn:Exslt.ExsltRegularExpressions"
exclude-result-prefixes="search umbraco.library RegularExpression">
[/code]
Note that 'umbracoNodeExceptions' is something I've added in the config file.
This is working now! Don't know what I changed but I hope it sticks. Thanks Spider!
np, glad you got there :)
is working on a reply...