I have an Umbraco 4.0.3 website and if you have been following my other posts you will know I have created an XSLT file to output data from one Umbraco website in XML so that it can be pulled into multiple other Umbraco sites. This is all working ok but I am stuck as to how I output the URL of an image that has been selected using a media picker so that I can show the image on the other websites. I assume I am going to need to output the full URL of the image in XML. If I use the following XSLT code then I get just the Image ID for <sitelogo> which is to be expected:
But this seemed to completely screw up my XML and caused the following error on the XML output page:
The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. -------------------------------------------------------------------------------- Invalid at the top level of the document. Error processing resource 'http://www.hymnsam.co.uk/hymnsam-sites.aspx'. Line 1,... <?xml version="1.0" encoding="UTF-8"?>
Can anyone see where I am going wrong? Also I assume I am going to need to output the image width and height because I will need that information on the page that is going to be displaying the image?
Sorry to pester, just wondered if anyone had any thoughts on this? I thought it was going to be a simple mistake I was making. I can't see why something that would give the URL normally via XSLT would cause a problem when outputting to XML?
Please ignore this, I have realised the problem is because I had some nodes that did not have an image so it would have been throwing out an XSLT error which was screwing up the XML output. I just need to put in an IF statement to check whether there is an image available.
Output full image url in XML using XSLT
Hi All,
I have an Umbraco 4.0.3 website and if you have been following my other posts you will know I have created an XSLT file to output data from one Umbraco website in XML so that it can be pulled into multiple other Umbraco sites. This is all working ok but I am stuck as to how I output the URL of an image that has been selected using a media picker so that I can show the image on the other websites. I assume I am going to need to output the full URL of the image in XML. If I use the following XSLT code then I get just the Image ID for <sitelogo> which is to be expected:
So I thought I would try the code that I usually use for showing images in XSLT as follows:
But this seemed to completely screw up my XML and caused the following error on the XML output page:
Can anyone see where I am going wrong? Also I assume I am going to need to output the image width and height because I will need that information on the page that is going to be displaying the image?
Sorry to pester, just wondered if anyone had any thoughts on this? I thought it was going to be a simple mistake I was making. I can't see why something that would give the URL normally via XSLT would cause a problem when outputting to XML?
Please ignore this, I have realised the problem is because I had some nodes that did not have an image so it would have been throwing out an XSLT error which was screwing up the XML output. I just need to put in an IF statement to check whether there is an image available.
is working on a reply...