Is it possible to generate an XML file from a folder that is on the web server but not in Umbraco? I have a folder with a bunch of images in it and I want to create an XML file that will list the URL to them so a custom flash photo gallery can use it.
So long as the folder is readable by the web-server user then you should be able to write an ASP .NET handler to enumerate all the files in the folder and generate the XML. Probably best way would be to use an .ashx handler to do this.
I probably should have been more clear. I was hoping to create an XSLT in umbraco that looks into the physical folder and have it generate the xml. Then I can reference a macro within an umbraco document to display the xml. I'm currently doing this for pages within umbraco but I am trying to do the same thing with a folder on the seb server instead.
I'd create a user control that takes the folder as input parameter and uses some of the available .net classes/functions to generate the xml. Add the user control to a macro and it can be used on all pages where it is required.
I'd create a user control that takes the folder as input parameter and uses some of the available .net classes/functions to generate the xml. Add the user control to a macro and it can be used on all pages where it is required.
XSLT can't get to the filesystem, so you'll have to look to C# or (gasp) Python to make your macro (yes, you can get to the file system from a Python macro). But more likely, the C# approach is better in the long run. You could either make a .net control or you could make an XSLT extension and then call it from within your xslt macro just like you do the umbraco.library:*() functions or the exslt functions. There are some good resources on making an xslt extension for umbraco that you can find quickly with Google.
cheers, and nice to see you on the forum again!
doug.
Generate XML from a Physical Path
Is it possible to generate an XML file from a folder that is on the web server but not in Umbraco? I have a folder with a bunch of images in it and I want to create an XML file that will list the URL to them so a custom flash photo gallery can use it.
Thanks,
GaryB
So long as the folder is readable by the web-server user then you should be able to write an ASP .NET handler to enumerate all the files in the folder and generate the XML. Probably best way would be to use an .ashx handler to do this.
I probably should have been more clear. I was hoping to create an XSLT in umbraco that looks into the physical folder and have it generate the xml. Then I can reference a macro within an umbraco document to display the xml. I'm currently doing this for pages within umbraco but I am trying to do the same thing with a folder on the seb server instead.
Thanks,
GaryB
Hi Gary,
I'd create a user control that takes the folder as input parameter and uses some of the available .net classes/functions to generate the xml. Add the user control to a macro and it can be used on all pages where it is required.
Regards,
/Dirk
[quote=Dirk]Hi Gary,
I'd create a user control that takes the folder as input parameter and uses some of the available .net classes/functions to generate the xml. Add the user control to a macro and it can be used on all pages where it is required.
Regards,
/Dirk
[/quote]
That sounds reasonable so I'll do that.
Thanks,
GaryB
Hi Gary,
XSLT can't get to the filesystem, so you'll have to look to C# or (gasp) Python to make your macro (yes, you can get to the file system from a Python macro). But more likely, the C# approach is better in the long run. You could either make a .net control or you could make an XSLT extension and then call it from within your xslt macro just like you do the umbraco.library:*() functions or the exslt functions. There are some good resources on making an xslt extension for umbraco that you can find quickly with Google.
cheers, and nice to see you on the forum again!
doug.
is working on a reply...