I'm trying to create what I thought was a pretty standard XLST + Macro to extract the URL for a media library item from its id. I'm trying to tes this with a known ID - so the following
So it is quite odd that you get img instead of Image and everything is lowercase in your example wherease the node names as definitely camel case. You can check this in the database in the table ContentXml. I have no idea why you only get the results, however try out umbracoFile instead of umbracofile and see what happens.
This seems like a bug. Please consider adding this as a issue in http://umbraco.codeplex.com if it's not there already. I sure would like this not to happen on one of mine. :-)
after some investigation, it turns out that there were 2 things going on:
1) As Arjan noted, my casing was wrong on umbracoFile - getting the case right fixed the immediate problem
2) the weird behavior that I ran into seems to be a real bug in the XSLT visualizer - more specifically in how the encode/decode result feature works. For example, if I write out the XML results to a textarea, I see the proper XML, but if I just write it directly (e.g. just the copy-of instruction), the markup is as I reported earlier when I click 'encode/decode result'
I'll submit this bug to codeplex and mark Arjan's reply as the answer.
Can't get media path from id
Running Umbraco 4.5.1
I'm trying to create what I thought was a pretty standard XLST + Macro to extract the URL for a media library item from its id. I'm trying to tes this with a known ID - so the following
<xsl:value-of select="umbraco.library:GetMedia('1092', false())/umbracofile"/>
unfortunately, I get no output
I tried backing up and looking at the entire result of teh GetMedia call with the following
<xsl:copy-of select="umbraco.library:GetMedia('1092', false())"/>
but the result was much less than helpful - in fact, the result wasn't even well formed
<img id="1092"
version="18deca79-9a45-44a6-95f2-2c66a78bc6c3"
parentid="1089"
level="3"
writerid="0"
nodetype="1032"
template="0"
sortorder="3"
createdate="2010-08-16T10:42:34"
updatedate="2010-08-16T10:42:34"
nodename="bullet.gif"
urlname="bullet.gif"
writername="Administrator"
nodetypealias="Image"
path="-1,1088,1089,1092"
>
<umbracofile>/media/1092/bullet.gif</umbracofile>
<umbracowidth>4</umbracowidth>
<umbracoheight>8</umbracoheight>
<umbracobytes>49</umbracobytes>
<umbracoextension>gif</umbracoextension>
Anybody have an idea what I could be doing wrong here?
tia,
_howard
Looks like it's well formed to me! :-)
Have a look at Lee Kelleher's blogpost about getting media items, that should help.
Hi Howard,
that is indeed very odd. I have made a quick test on my 4.5.1 install with the following Xslt:
This is the output:
<Image id="1049" version="070a23ce-d837-493e-8c14-3d454bfbc4aa" parentID="-1" level="1" writerID="0" nodeType="1032" template="0" sortOrder="0" createDate="2010-08-10T23:26:33" updateDate="2010-08-10T23:26:33" nodeName="asdf" urlName="asdf" writerName="Administrator" nodeTypeAlias="Image" path="-1,1049">
<umbracoFile>/media/7/about.png</umbracoFile>
<umbracoWidth>16</umbracoWidth>
<umbracoHeight>16</umbracoHeight>
<umbracoBytes>931</umbracoBytes>
<umbracoExtension>png</umbracoExtension>
</Image>
So it is quite odd that you get img instead of Image and everything is lowercase in your example wherease the node names as definitely camel case. You can check this in the database in the table ContentXml. I have no idea why you only get the results, however try out umbracoFile instead of umbracofile and see what happens.
Cheers,
Sascha
Hi Howard,
This seems like a bug. Please consider adding this as a issue in http://umbraco.codeplex.com if it's not there already. I sure would like this not to happen on one of mine. :-)
/Jesper
This call is case-sensitive:
Should be:
after some investigation, it turns out that there were 2 things going on:
1) As Arjan noted, my casing was wrong on umbracoFile - getting the case right fixed the immediate problem
2) the weird behavior that I ran into seems to be a real bug in the XSLT visualizer - more specifically in how the encode/decode result feature works. For example, if I write out the XML results to a textarea, I see the proper XML, but if I just write it directly (e.g. just the copy-of instruction), the markup is as I reported earlier when I click 'encode/decode result'
I'll submit this bug to codeplex and mark Arjan's reply as the answer.
thanks,
_howard
is working on a reply...