Jump to content

Help For Possible Xslt Code For Getting The Images

Recommended Posts

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!

  • Like 1
Link to post
Share on other sites

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...