I found something like this on the xWiki web site but it doesn't quite work.

This is what I put on the page.

#set($attachment=$doc.getAttachment("MyFile.doc"))
#mimetypeimg($attachment.getMimeType().toLowerCase() $attachment.getFilename().toLowerCase())


"MyFile.doc" is an attached MS Word document. (Attached to that page.)

The funny thing about it is that when the page displays it shows the ICON followed by some extra stuff that looks like this:

doc?" title=" doc?"/>

The problem seems to lie in the html where the code generated by the Velocity stuff above looks like this:

<img src="/xwiki/skins/albatross/mimetypes/word.png"
alt="<a class="wikicreatelink" href= "/xwiki/bin/edit/WARS/doc?parent=WARS.2005&editor=wysiwyg"><span class="wikicreatelinktext" >doc</span><span class="wikicreatelinkqm">?</ span></a>" title="<a class="wikicreatelink" href="/xwiki/bin/edit/WARS/doc?parent=WARS.2005&editor=wysiwyg"><span class= "wikicreatelinktext">doc</span><span class="wikicreatelinkqm" >?</span></a>"
/>

I first looked at xWiki last Thursday so I don't know much about what's going on. But that looks to me like some sort of text substitution is taking place where the contents of the "alt" is expanded into something containing a double-quote that ends the "alt" before its time. That makes the funny stuff display when it should only create an "alt" message for the image. The class "wikicreatelink" makes me suspicious as well.

So ... am I doing something wrong in the Velocity code above when I try to create the interesting icon on the page?
Or ... is something in the xwiki application messing it up? (And, if so, is there some workaround.)

Thanks.

--
-- Lee Meador