[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: RE: Yahoo shopping feed, XSLT choking on xmlns
Sure thing. Here is the XML I'm using: http://api.shopping.yahoo.com/ShoppingService/v1/productSearch?appid=Yah ooDemo&query=ipod+shuffle Below is my best-so-far attempt at the XSL. It's long, so I've shoved it to the bottom. When I apply this to the XML, I my result is this: <?xml version="1.0" encoding="utf-8"?><div id="yshop"><table/></div> But if I edit the XML and remove the xmlns: attribute, I get the whole shebang with all my titles and pictures. But alas, I can't do that in the real world... but that's how I figured out what part of the XML was choking my XSLT Here's the XSL **-- begin xsl --** <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <div id="yshop"> <table> <xsl:apply-templates select="ResultSet/Result" /> </table> </div> </xsl:template> <xsl:template match="Result"> <xsl:apply-templates /> </xsl:template> <xsl:template match="Offer"> <table> <TR> <TD colspan="2"><h3><xsl:value-of select="ProductName"/></h3></TD> </TR> <TR> <TD> <img> <xsl:attribute name="src"> <xsl:value-of select="Thumbnail/Url"/> </xsl:attribute> <xsl:attribute name="width"> <xsl:value-of select="Thumbnail/Width"/> </xsl:attribute> <xsl:attribute name="height"> <xsl:value-of select="Thumbnail/Height"/> </xsl:attribute> </img> </TD> <TD> <xsl:text>Price: $</xsl:text> <xsl:value-of select="Price"/> <br /> <a> <xsl:attribute name="href"> <xsl:value-of select="Url"/> </xsl:attribute> Buy now </a> </TD> </TR> </table> </xsl:template> <xsl:template match="ResultSet/Result/Catalog"> <table> <tr> <td colspan="2"><h3><xsl:value-of select="ProductName"/></h3></td> </tr> <tr> <td> <img> <xsl:attribute name="src"> <xsl:value-of select="Thumbnail/Url"/> </xsl:attribute> <xsl:attribute name="width"> <xsl:value-of select="Thumbnail/Width"/> </xsl:attribute> <xsl:attribute name="height"> <xsl:value-of select="Thumbnail/Height"/> </xsl:attribute> </img> </td> <td> <xsl:if test="UserRating/NumRatings > 0"> <xsl:text>Average Rating: </xsl:text> <xsl:value-of select="UserRating/AverageRating"/> / <xsl:value-of select="UserRating/MaxRating"/> <br /> </xsl:if> <xsl:text>From $</xsl:text> <xsl:value-of select="PriceFrom"/> <xsl:text> to $</xsl:text> <xsl:value-of select="PriceTo"/> <br /> <a> <xsl:attribute name="href"> <xsl:value-of select="Url"/> </xsl:attribute> Buy now </a> </td> </tr> </table> </xsl:template> </xsl:stylesheet> **-- end xsl --** -----Original Message----- From: Michael Kay [mailto:mike@xxxxxxxxxxxx] Sent: Friday, August 26, 2005 10:36 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: RE: Yahoo shopping feed, XSLT choking on xmlns What does the choking sound like through a stethoscope? Or to put it another way, could you be more precise about the symptoms you are observing? It might also be useful to show your best attempt at a stylesheet to handle this - this will rapidly tell people where your misunderstanding lies. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Ian Ring [mailto:iring@xxxxxxxxxxx] > Sent: 26 August 2005 15:25 > To: Ian Ring; xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: Yahoo shopping feed, XSLT choking on xmlns > > Take a look at this XML feed: > http://api.shopping.yahoo.com/ShoppingService/v1/productSearch > ?results=5 > &appid=yahoodemo&query=cheese > > The <ResultSet> node has an attribute: > xmlns="urn:yahoo:prods" > > XSL is choking on that attribute. If I remove it, my transformation > proceeds fine. But - in the real world, I can't edit the > incoming XML. I > only have control over my XSL sheet. > > I've been trying for 3 days to make an XSLT that will transform that > into HTML. > I'm using Microsoft .NET, XSL version 1.0 > > Can anyone help me? > A little sample XSL code that gets past the <ResultSet> node > is all I'll > need > ~ i
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|