I want to show the thumbnails of all images whis is also available in XML file. Please help me how to do this
I have this type of XML (test.xml) :
<?xml version="1.0" encoding="UTF-16"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<My_Collection_DB Name="New Database.bxd">
<CD_DVD Name="200810151145" Size="175701901" Date="10/15/2008 11:51 AM" Disk_ID="4" Volume_Serial_Number="-1533743809" Volume="200810151145">
<File_Folder Name="wallpapers" Size="175701901" Date="10/15/2008 11:44 AM">
<File Name="24-the-game.jpg" Size="109605" Date="10/5/2008 4:33 AM" Description="1280 x 960, 24bit" Thumbnail="24-the-game.jpg"/>
<File Name="a-hired-killer.jpg" Size="166136" Date="10/5/2008 7:01 AM" Description="1280 x 1024, 24bit" Thumbnail="a-hired-killer.jpg"/>
<File Name="above-the-clouds.jpg" Size="334940" Date="10/5/2008 6:49 AM" Description="1280 x 1024, 24bit" Thumbnail="above-the-clouds.jpg"/>
<File Name="action.jpg" Size="280926" Date="10/5/2008 9:15 AM" Description="1280 x 960, 24bit" Thumbnail="action.jpg"/>
<File Name="all-about-race.jpg" Size="566677" Date="10/6/2008 9:01 AM" Description="1600 x 1200, 24bit" Thumbnail="all-about-race.jpg"/>
<File Name="alley.jpg" Size="272893" Date="10/5/2008 5:33 AM" Description="1280 x 960, 24bit" Thumbnail="alley.jpg"/>
<File Name="xplosion.jpg" Size="357351" Date="10/5/2008 5:33 AM" Description="1280 x 960, 24bit" Thumbnail="xplosion.jpg"/>
<File Name="zombie.jpg" Size="154505" Date="10/5/2008 5:13 AM" Description="1280 x 960, 24bit" Thumbnail="zombie.jpg"/>
</File_Folder>
</CD_DVD>
<CD_DVD Name="RESOURCE_CD" Size="287309615" Date="10/15/2008 11:16 AM" Disk_ID="2" Volume_Serial_Number="-1153338003" Volume="RESOURCE_CD">
<File_Folder Name="CSD" Size="56450" Date="8/14/2007 3:44 PM">
<File_Folder Name="TOOLS" Size="56450" Date="8/14/2007 3:44 PM">
<File_Folder Name="BIOS" Size="56450" Date="8/14/2007 3:44 PM">
<File Name="ASSET102.EXE" Size="46712" Date="8/25/2006 2:08 AM"/>
<File Name="ASSET209.COM" Size="9738" Date="4/5/2005 1:35 AM"/>
</File_Folder>
</File_Folder>
</File_Folder>
<File_Folder Name="DIAGS" Size="7242786" Date="8/14/2007 3:44 PM">
<File_Folder Name="DIAG32" Size="7242786" Date="8/14/2007 3:44 PM">
<File_Folder Name="A1309A1" Size="7242786" Date="8/14/2007 3:44 PM">
<File Name="ADAPTEC.MDM" Size="325127" Date="7/15/2007 10:27 AM"/>
<File Name="ADAPTEC2.MDM" Size="316647" Date="7/15/2007 10:27 AM"/>
<File Name="AMI_RAID.MDM" Size="48283" Date="7/15/2007 10:27 AM"/>
</File_Folder>
</File_Folder>
</File_Folder>
</CD_DVD>
</My_Collection_DB>
and thistype of XSL file (test.xsl) :
<?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="File_Folder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<div align="left">
<a>
<xsl:attribute name = "href">javascript:hide('<xsl:value-of select="generate-id(.)"/>')</xsl:attribute>
<img src="Green_dot.png" alt="Contrae/Expande" style="border:0px solid;">
<xsl:attribute name = "id"><xsl:value-of select="generate-id(.)"/>_i</xsl:attribute>
</img>
</a>
<a>
<xsl:attribute name = "href">javascript:hide('<xsl:value-of select="generate-id(.)"/>')</xsl:attribute>
<img src="FileFolder.png" alt="File Folder" style="border:0px solid;"/>
</a>
<xsl:value-of select="@Name"/>
</div>
</td>
</tr>
<tr>
<td width="35"></td>
<td>
<div style="display:none">
<xsl:attribute name = "id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
<xsl:for-each select=".">
<xsl:sort select="@Name"/>
<xsl:apply-templates/>
</xsl:for-each>
</div>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="Shortcut">
<img src="Shortcut.png" alt="Shortcut" style="border:0px solid;"/> <xsl:value-of select="@Name"/><br/>
</xsl:template>
<xsl:template match="File">
<img src="File.png" alt="File" style="border:0px solid;"/> <xsl:value-of select="@Name"/> - <xsl:value-of select="round((@Size div 1048576) * 100) div 100"/>MB<br/>
</xsl:template>
<xsl:template match="CD_DVD">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<div align="left">
<a>
<xsl:attribute name = "href">javascript:hide('<xsl:value-of select="generate-id(.)"/>')</xsl:attribute>
<img src="Green_dot.png" alt="Contrae/Expande" style="border:0px solid;">
<xsl:attribute name = "id"><xsl:value-of select="generate-id(.)"/>_i</xsl:attribute>
</img>
</a>
<a>
<xsl:attribute name = "href">javascript:hide('<xsl:value-of select="generate-id(.)"/>')</xsl:attribute>
<img src="cd_dvd.png" alt="CD_DVD" style="border:0px solid;"/>
</a>
<xsl:value-of select="@Name"/>
</div>
</td>
</tr>
<tr>
<td width="35"></td>
<td>
<div style="display:none">
<xsl:attribute name = "id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
<xsl:for-each select=".">
<xsl:sort select="@Name"/>
<xsl:apply-templates/>
</xsl:for-each>
</div>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="Disk_Folder">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<div align="left">
<a>
<xsl:attribute name = "href">javascript:hide('<xsl:value-of select="generate-id(.)"/>')</xsl:attribute>
<img src="Green_dot.png" alt="Contrae/Expande" style="border:0px solid;">
<xsl:attribute name = "id"><xsl:value-of select="generate-id(.)"/>_i</xsl:attribute>
</img>
</a>
<a>
<xsl:attribute name = "href">javascript:hide('<xsl:value-of select="generate-id(.)"/>')</xsl:attribute>
<img src="DiskFolder.png" alt="Disk Folder" style="border:0px solid;"/>
</a>
<xsl:value-of select="@Name"/>
</div>
</td>
</tr>
<tr>
<td width="35"></td>
<td>
<div style="display:none">
<xsl:attribute name = "id"><xsl:value-of select="generate-id(.)"/></xsl:attribute>
<xsl:for-each select=".">
<xsl:sort select="@Name"/>
<xsl:apply-templates/>
</xsl:for-each>
</div>
</td>
</tr>
</table>
</xsl:template>
<xsl:template match="/">
<html>
<head>
<script language="javascript" src="test.js"></script>
</head>
<body style="font-size:11px; font-family:Arial, Helvetica, sans-serif;">
<img src="Base.png" alt="Broken X Database" style="border:0px solid;"/> <strong><xsl:value-of select="Broken_X_Database/@Name"/></strong>
<xsl:for-each select="Broken_X_Database/.">
<xsl:sort select="@Name"/>
<xsl:apply-templates/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
And this JS using :
function returnObjById( id )
{
if (document.getElementById)
var returnVar = document.getElementById(id);
else if (document.all)
var returnVar = document.all[id];
else if (document.layers)
var returnVar = document.layers[id];
return returnVar;
}
function hide( id , me)
{
var obj = returnObjById( id );
var obj2 = returnObjById( id+"_i" );
if (obj.style.display == "none"){
obj.style.display = "block";
obj2.src = "Red_dot.png";
}
else {
obj.style.display = "none";
obj2.src = "Green_dot.png";
}
}
I want to show the thumbnails of all images whis is also available in XML file. Please help me how to do this