xpathxformsxsltforms

XSLTForms: set attributes on output node? (<xf:output>)


The following output works (it is part of an <xforms:repeat), but is there a way I can dynamically set the value of attributes?

<xf:output value="concat(
instance('images')/@base_api,
resource[@href=../links/resource[@rel='image']/@href]/links/resource[@rel='thumbnail']/@href)" 
mediatype="image/*
width="64px" height="64px"
/>

So assuming I have 'width' and 'height' properties within my model - is there a way of setting the attributes from the model, rather than hard-coding to '64px' as I have here?

I also want to set the 'alt' attribute.

I'm using client-side XSLTForms, Version: 1.2.


Solution

  • AVT allows you to embed XPath expressions within an attribute value using {}. For example: width="{resource/image/size * 2}px"