尝试针对以下内容运行 XSLT,但我认为命名空间有问题?
XML 示例:
<rss version="2.0" xmlns="http://www.w3.org/ns/rex#" xmlns:mysmartprice="http://www.w3.org/2000/mysmartprice" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<offers>
<pubDate/>
<title>ShopClues Deals Feed</title>
<link>http://www.shopclues.com</link>
<description>Great Deals on branded products</description>
<language>en-gb</language>
<offer>
<mysmartprice:Product_Name>BreatheMaxTherapeuticPillow</mysmartprice:Product_Name>
<mysmartprice:Price>4999.00</mysmartprice:Price>
<mysmartprice:ourprice>4499.00</mysmartprice:ourprice>
<mysmartprice:URL>http://www.shopclues.com/breathe-max-therapeutic-pillow.html</mysmartprice:URL>
<mysmartprice:Prod_Image>http://cdn.shopclues.com/images/thumbnails/0/160/160/Breathe-Max-Therapeutic-P_1002001.000.CLM13218638854eca0acd18439.png</mysmartprice:Prod_Image>
<mysmartprice:Shipping_Price>0</mysmartprice:Shipping_Price>
<mysmartprice:Shipping_Time>5-7 working days</mysmartprice:Shipping_Time>
<mysmartprice:Availability>Out Of Stock</mysmartprice:Availability>
<mysmartprice:Brand>Calma</mysmartprice:Brand>
<mysmartprice:Category>Bed Linen </mysmartprice:Category>
<mysmartprice:SubCategory>Pillows</mysmartprice:SubCategory>
</offer>
</offers>
</rss>
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:omg="http://feeds.omgadmin.co.uk/feeds/ns/1.0/" xmlns:rss="http://feeds.omgeu.com/ns/1.0/" xmlns:mysmartprice="http://www.w3.org/2000/mysmartprice">
<xsl:param name="pubDate"/>
<xsl:param name="channelTitle" select="Test"/>
<xsl:param name="channelLink"/>
<xsl:param name="channelDescription"/>
<xsl:param name="channelLanguage"/>
<xsl:param name="channelCopyright"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
<xsl:template match="/">
<rss version="2.0">
<channel>
<pubDate><xsl:value-of select="$pubDate"/></pubDate>
<title><xsl:value-of select="$channelTitle"/></title>
<link><xsl:value-of select="$channelLink"/></link>
<description><xsl:value-of select="$channelDescription"/></description>
<language><xsl:value-of select="$channelLanguage"/></language>
<copyright><xsl:value-of select="$channelCopyright"/></copyright>
<omg:processCount><xsl:value-of select="count(//product)"/> </omg:processCount>
<xsl:apply-templates/>
</channel>
</rss>
</xsl:template>
<xsl:template name="itemTemplate" match="offer">
<item>
<!--<omg:merchantrank>0</omg:merchantrank>-->
<omg:pid>10543</omg:pid>
<title><xsl:value-of select="mysmartprice:Product_Name"/></title>
<description><xsl:value-of select="mysmartprice:Product_Name"/></description>
<link><xsl:value-of select="mysmartprice:URL"/></link>
<omg:imageurlsmall></omg:imageurlsmall>
<omg:imageurlmedium><xsl:value-of select="mysmartprice:Prod_Image"/></omg:imageurlmedium>
<omg:imageurllarge></omg:imageurllarge>
<omg:price><xsl:value-of select="mysmartprice:ourprice"/></omg:price>
<omg:currency>INR</omg:currency>
<omg:sku><xsl:value-of select="mysmartprice:Product_Name"/>- <xsl:value-of select="mysmartprice:Brand"/></omg:sku>
</item>
</xsl:template>
</xsl:stylesheet>
我在顶部做了命名空间声明,但是当我从 XML 中选择值时我没有得到任何回报?
非常感谢任何帮助。
提前致谢。