Inserting images from XML to XSL document

apetthouptDog

New Member
Hi there i am a beginner with using XML and XSL. I was wondering if there is any way i can declare an image in the XML file using an element or attribute and then use this image in the XSL file to input it into a table instead of having to create the table in XSL and inputting the images into the table cells one by one. Here is my current XML document(incomplete as i am just testing it out.) \[code\]<?xml version= "1.0"?><?xml-stylesheet type="text/xsl" href="http://stackoverflow.com/questions/13780145/stylesheet4.xsl"?> <countries> <country> <countryname>United States</countryname> <countryflag>bg_locale.jpg</countryflag> </country> <country> <countryname>United Kingdom</countryname> </country> <country> <countryname>Deutschland</countryname> </country> </countries>\[/code\]Here is the XSL file i created and the method i tried using: \[code\]<?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/countries"><html><body bgcolor="black"><div id="container" style="100%"><div id="header" style="background-color:black; height:60px"></div><div id="content_container" align="center"> <div id="content" align="left" style="background: url('bg_locale.jpg');height:845px;width:848px"> Content goes here <img src="http://stackoverflow.com/questions/13780145/logo_timber.jpg" align="left"/><br/><br/><br/><br/><table border="1"><tr><xsl:apply-templates/></tr></table></div></div></div></body></html></xsl:template><xsl:template match="country"><tr><td><xsl:value-of select="countryflag"/></td></tr></xsl:template></xsl:stylesheet>\[/code\]As you can see i have created a table and want the XSL to get the image from the XML file and then have it so every countryflag image is displayed in the table one by one.Could you please help me out thanks.
 
Back
Top