getattribute() in osl is not working
The texture only appeared after I added another Image Texture node (which is not realated to anything). Muting this node if enough to make the texture disappear.

The topic is also discussed on an older BA-Thread

You could use Input/UV-Map node to get the UV-coordinates:

Wiring the UV makes them accessible for getattributes