The basic idea is that you need XSLT to loop through your media and create the looping javascript code. Then embed a macro into the middle of your javascript which will output the looping media code.
Assuming your XSLT above is correct, but that you also have the rest of your settings (flickr URL, from, to, time) within the documenttype, create an XSLT file with a macro and add this to your XSLT file:
I'm working on a site where I'll make quite heavy use of javascript and at the same time I will need to fetch data from Umbraco. Yes, I could create an XSLT-script that generates javascript code and put it as a macro in the template. But if the macro just prints the javascript, it would be added to the page as a page script like this:
<script type="text/javascript"> //My script code goes here </script>
...and browsers don't cache these scripts like they do when you have them in a separate file and included on the page like this:
The second idea I have is to use a regular .js file and have it load data using AJAX from a resource page that I set up in Umbraco. This page would just contain an XSLT-script that generates JSON. Still it would mean an extra call to the server.
Mixing Xslt and Javascript
Hi!
I know this can be made but not sure of the syntax. Im trying to make Jquery Crosslide Gallery and populate it from xslt.
How can I put the For each inside the javascript?
Hi Froad,
The basic idea is that you need XSLT to loop through your media and create the looping javascript code. Then embed a macro into the middle of your javascript which will output the looping media code.
Assuming your XSLT above is correct, but that you also have the rest of your settings (flickr URL, from, to, time) within the documenttype, create an XSLT file with a macro and add this to your XSLT file:
Then in your template, replace the looping javascript with a reference to the macro:
The syntax here might need some tweaking, but it should start you off at least. Hope it helps a little...
Hi!
I'm working on a site where I'll make quite heavy use of javascript and at the same time I will need to fetch data from Umbraco. Yes, I could create an XSLT-script that generates javascript code and put it as a macro in the template. But if the macro just prints the javascript, it would be added to the page as a page script like this:
...and browsers don't cache these scripts like they do when you have them in a separate file and included on the page like this:
The second idea I have is to use a regular .js file and have it load data using AJAX from a resource page that I set up in Umbraco. This page would just contain an XSLT-script that generates JSON. Still it would mean an extra call to the server.
Is there a smarter way that I haven't thought of?
Regards,
Thomas Kahn
is working on a reply...