Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT element ID and images

Status
Not open for further replies.

frodosfoot

IS-IT--Management
Nov 29, 2006
9
0
0
GB
In my xml, certain elements have an id. For example:

<countryfrom id="21">Brasil</countryfrom>

In my xslt I'm using <xsl:value-of select="countryfrom"/> to get the country name into the relevant cell of a table.

However, what I'd like to do is to show the country flag in addition to its name. Each country has an ID and each flag image has a name that is linked to its ID. For example, Brazil's flag image is "21.png". What needs to be added to the xslt file to get it to print out the correct flag for the ID?
 
Something like this:
Code:
<img>
  <xsl:attribute name="src">
    <xsl:value-of select="concat(countryfrom/@id,'.png')"/>
  </xsl:attribute>
</img>

That should get you started...

Tom Morrison
 
Yeah, that's quite impressive ... and simple too.

Does the job perfectly.

Thanks,

DAK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top