xsl-list
[Top] [All Lists]

RE: RE: Yahoo shopping feed, XSLT choking on xmlns

2005-08-26 08:39:15
Please see

http://www.dpawson.co.uk/xsl/sect2/N5536.html#d6629e1012

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Ian Ring [mailto:iring(_at_)geosign(_dot_)com] 
Sent: 26 August 2005 15:43
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] 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 &gt; 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(_at_)saxonica(_dot_)com] 
Sent: Friday, August 26, 2005 10:36 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] 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(_at_)geosign(_dot_)com] 
Sent: 26 August 2005 15:25
To: Ian Ring; xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>