<xsl:attribute> bygga upp href, img element osv
<img>
<xsl:attribute name="src">
<xsl:value-of select="@url"/>
</xsl:attribute>
</img>
Outputen blir
<img src="xml-urlen">
Bygga upp länk, href med url data från xmlen:
<a>
<xsl:attribute name="href">
<xsl:call-template name="HREF_BUILD"/>
</xsl:attribute>
<xsl:call-template name="Les flere nyheter"/>
Länkens namn
<img src="{$urlroot}filestore/{ATTRIBUTES/ATTRIBUTE[LABEL = 'eventImage']/VALUE/FILE/FILENAME}"/>
Outputen blir
Länkens namn
xsl:attribute
The xsl:attribute allows you to add an attribute to an element. This element is often used when you need to add a source(src) to an image. Remembering that in HTML an img tag is still an element in XML term. So when we are wanting to add any of these attributes to elements, you need to use this technique.
<xsl:attribute name="src">
<xsl:value-of select="@url"/>
</xsl:attribute>
</img>
Outputen blir
<img src="xml-urlen">
Bygga upp länk, href med url data från xmlen:
<a>
<xsl:attribute name="href">
<xsl:call-template name="HREF_BUILD"/>
</xsl:attribute>
<xsl:call-template name="Les flere nyheter"/>
Länkens namn
<img src="{$urlroot}filestore/{ATTRIBUTES/ATTRIBUTE[LABEL = 'eventImage']/VALUE/FILE/FILENAME}"/>
Outputen blir
Länkens namn
xsl:attribute
The xsl:attribute allows you to add an attribute to an element. This element is often used when you need to add a source(src) to an image. Remembering that in HTML an img tag is still an element in XML term. So when we are wanting to add any of these attributes to elements, you need to use this technique.