I'd forgotten to put the /data blah blah blah bit on the end. So Umbraco was pulling back the whole node. That was why I was getting what appeared to be 2 filenames jammed together. For some reason my brain really doesnt want to learn XSLT syntax!
I'm using Umbraco 4.5 and I'm getting a similar long link but I do not understand how to get ONLY the path. 1135 is an id of a picture in Media. The code returns
<img src="/media/1435/nieuws2.jpgjpg14694"> which is to much obviously.
Using true() as the second paramater instead of false() or 0 actually recursively gets all media nodes under the selected node as well. This can be a bit of a performance hog so is best avoided unless you specifically want the children of the selected media item.
The default media file node is called File, so this should work
GetMedia nightmares
Hello.
I'm trying to write a XSLT file triggered by a Macro that will display an image that has been uploaded using the media picker.
If I use the following code
[code]
[/code]
it returns the following url.
/media/100/single-logo.gif45045039931gif
the first bit of which is correct. I have no idea what the second bit is.
If I use another bit of code suggested by Dirk in another forum
[code]
[/code]
I get no errors in the xsl edit panel, but the following is output to the page.
Error parsing XSLT file: \xslt\BoxList.xslt
I'm at my wits end. I only want to display an image!](*,)
Forget it, Its solved. I was bringing the whole node back as I hadn't specified which bit I wanted.
Not sure what the other bit of code was doing to generate the error but it's working now.
I'm having the same issue, what did you do to fix it?
Hi MediaCrisis
This is the line that fixed the issue for me
[code]
[/code]
I'd forgotten to put the /data blah blah blah bit on the end. So Umbraco was pulling back the whole node. That was why I was getting what appeared to be 2 filenames jammed together. For some reason my brain really doesnt want to learn XSLT syntax!
I'm up against the same problem with the filename but it seems the new forum has eaten your solution.
as a matter of fact any code snippets inserted into the forum prior to this new forum have disappeared???
man how friggin frustration is this
Martin this is the original forum message
http://forum.umbraco.org/yaf_postst8180_GetMedia-nightmares.aspx
With all the code in :)
Hello,
I'm using Umbraco 4.5 and I'm getting a similar long link but I do not understand how to get ONLY the path. 1135 is an id of a picture in Media. The code returns
<img src="/media/1435/nieuws2.jpgjpg14694"> which is to much obviously.
select="umbraco.library:GetMedia(1155, 0)/data [@alias = 'umbracoFile']" returns nothing (<img src="">).
Help would be much appreciated ;-)
Teus
Hi Teus
In 4.5 the syntax is a little different due tot he different xml schema
Should get you the path to the file
Dan
Thanks Dan, that was the trick. Is there documentation somewhere about this ?
And another question springs to mind:
produces the xml of the media item:
So why doesn't this(* = file) work? (Please note that I studied XSLT for 3 hours ;-) )
Hi Teus
Using true() as the second paramater instead of false() or 0 actually recursively gets all media nodes under the selected node as well. This can be a bit of a performance hog so is best avoided unless you specifically want the children of the selected media item.
The default media file node is called File, so this should work
Also, you may want to watch that it's a File and not an Image. If it could be either then you'd be best to use the * selector.
Also this wiki page may help -> http://our.umbraco.org/wiki/reference/xslt/45-xml-schema
Hope this helps,
Dan
Thanks Dan, thats clear.
Teus
is working on a reply...