Jump to content

XML AND XQUERY HELP


Recommended Posts

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

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 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.

Guest
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.

Loading...
×
×
  • Create New...