babynaamaw Posted September 19, 2011 Share Posted September 19, 2011 Sorry for being a newbie but I badly need this code to run my project. I want to know any possible xslt code to output images. Here is my XML code:<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="sample.xslt"?><rental modTime="2011-08-30-15:02:54" status="current"><images><img id="a" modTime="2011-08-30-15:02:54" file="p2i4.jpg"/><img id="b" modTime="2011-08-30-15:02:54" file="p2i5.jpg"/><img id="c" modTime="2011-08-30-15:02:54" file="p2i6.jpg"/><img id="d" modTime="2011-08-30-15:02:54" file="p2i7.jpg"/><img id="e"/><img id="f"/><img id="g"/><img id="h"/><img id="i"/><img id="j"/><img id="k"/><img id="l"/><img id="m" modTime="2011-08-30-15:02:54" file="Photo/p2i3.jpg"/><img id="n"/><img id="o"/><img id="p"/><img id="q"/><img id="r"/><img id="s"/><img id="t"/><img id="u"/><img id="v"/><img id="w"/><img id="x"/><img id="y"/><img id="z"/></images></rental><name></name><creationDate></creationDate><author></author><copyright></copyright><authorEmail></authorEmail><authorUrl></authorUrl><version></version><description></description><files><filename>console.xml</filename><filename>p2i3.jpg</filename><filename>p2i4.jpg</filename><filename>p2i5.jpg</filename><filename>p2i6.jpg</filename><filename>p2i7.jpg</filename><filename>p3i8.jpg</filename><filename>p4i10.jpg</filename><filename>p4i9.jpg</filename><filename>p5i11.jpg</filename><filename>p5i12.jpg</filename><filename>console.xml</filename></files> Thank you in advance! Link to comment Share on other sites More sharing options...
ckrudelux Posted September 20, 2011 Share Posted September 20, 2011 The xslt is just rules on then to apply xml data into html code. <xsl:template match="img"> <img alt="image" src="{@id}.jpg" /></xsl:template> This match all img elements from your xml file and puts the id attribute as the name/path/src to the image you want to load. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.