It would be nice to be able to do this without using (even short snippets of) inline c# in templates. Also would be a better separation of concerns, with no behavioural code in xsl.
For this package, you simply set the filename and MIME type once when you insert it in a template, then put your output xslt in the same template and when your user visits the page they'll be prompted to download the output of your xslt using the supplied filename and MIME type.
In v4 you can also use the contenttype element/control
In Umbraco 4 we introduced the <umbraco:ContentType /> control so you can use that as well - for instance:
<umbraco:ContentType runat="server" MimeType="text/xml"></umbraco:ContentType>
Nice! is there a built-in control to change the filename presented in the "save as" dialogue box?
No, but a cool idea to add that as another attribute! Could you add to Codeplex?
Added to http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=24700
It would be nice to be able to do this without using (even short snippets of) inline c# in templates. Also would be a better separation of concerns, with no behavioural code in xsl.
Cheers again
Dan
How do i use this?
Is it possible to get the filename from the querystring?
Hi Peter
For this package, you simply set the filename and MIME type once when you insert it in a template, then put your output xslt in the same template and when your user visits the page they'll be prompted to download the output of your xslt using the supplied filename and MIME type.
I think for passing the filename via a querystring that the c# function in xslt is your best bet, see below (and http://our.umbraco.org/projects/change-output/general/4246-Also-possible-using-inline-script-in-xslt)
Then just pass the filename via page.aspx?filename=whatever.csv
Hope this helps,
Dan
is working on a reply...