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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i store an image in xml, how would i get it out in an HTML file

Status
Not open for further replies.

yoda1979

Programmer
Jun 8, 2003
3
US
hey guys,

im trying, to store an image in an xml file, i know its prolly basic, but how do i do that and how would i get it out and use it in like a pop-up from an XHTML file? any takers :)

thx,
yoda
 
Hi Im fairly new to xml too but ill have a crack at your question,

Ok in your XML file you can give a path to your image
and the place that it links to
for example...

The following is a image on google that when clicked on would link to google.co.uk...

<image>
<path> <link></image>

and then in your XSL document it would look something like this...

<?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?>
<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;
<xsl:template match=&quot;/&quot;>
<xsl:for-each select=&quot;image&quot;>

<a><xsl:attribute name=&quot;href&quot;>
<xsl:value-of select=&quot;link&quot; />
</xsl:attribute>
<img><xsl:attribute name=&quot;src&quot;>
<xsl:value-of select=&quot;path&quot; />
</xsl:attribute>
</img>
</a>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>


hope this helps, the xsl:attirbute allow you to insert values from the xml file into the html document.

The for-each loops around each image but seeing as there is only 1 it would only display once.

Good luck :D

ps. the post above has &quot;;&quot; after the link and path, the xml and xsl dont need them i dont know why it adds them in after i posted the reply!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top