sherrynaeem2 Posted August 22, 2008 Share Posted August 22, 2008 Hello every one..Well am new here.Hmm the problem am having is that i have got an XML database for auction website displayed below:<?xml version="1.0" encoding="iso-8859-1" ?><ProductsDataSet xmlns:xlink="http://www.w3.org/1999/xlink"> <Mobiles id="N73_Plum1"> <Make>Nokia</Make> <Model>N73</Model> <Colour>Plum</Colour> <Price>$560</Price> <Image>images/Mobiles/Nokia/N73_Plum_1.jpg</Image> <Bid>Bid Now !!</Bid> </Mobiles></ProductsDataSet>I cant figure how to write query for it.I am displaying the info with XSLT table on one page i.e ActiveAuctions.aspx..so when i click on the image i wana go to another page ItemData.aspx. The ItemData page should show info about only the selected image. The image is an hyperlink. the xslt file is displayed below.<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <html> <head> </head> <body> <table width="100%" border="2"> <tr text-align="center"> <xsl:for-each select="/ProductsDataSet/Mobiles[2]"> <td bgcolor="silver"> <B style="font-size:18px">Make</B> <I style="padding-left:34px;font-size:18px"> <xsl:value-of select="Make"/> </I> <br/> <B style="font-size:18px">Model</B> <I style="padding-left:24px;font-size:18px"> <xsl:value-of select="Model"/> </I> <br/> <B style="font-size:18px">Colour</B> <I style="padding-left:20px;font-size:18px"> <xsl:value-of select="Colour"/> </I> <br/> <B style="font-size:18px">Price</B> <I style="padding-left:30px;font-size:18px"> <xsl:value-of select="Price" /> </I> </td> <td> <img> <xsl:attribute name="src"> <xsl:value-of select="Image" /> </xsl:attribute> <xsl:attribute name="width">240</xsl:attribute> <xsl:attribute name="height">200</xsl:attribute> </img> </td> </xsl:for-each> </tr> </table> </body> </html></xsl:template></xsl:stylesheet> I hope someone can figure something for me..i know the theory behind it but just cant get it working..i might be missing something. Link to comment Share on other sites More sharing options...
Kahor Posted August 25, 2008 Share Posted August 25, 2008 Hmm, first, your XSLT works if you remove the [2] from <xsl:for-each select="/ProductsDataSet/Mobiles[2]">Also you should probably use <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">instead of <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">For your link, why don't you just put a link tag in XSLT around your <img> ? (or a href as attribute of img, can't remember the correct syntax now)Anyhow, it displays properly when I use your XSLT with those simple correction, shouldn't be a prob for you if you managed to write it this far. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.