Hello guys, I am new to XML and working on a XSLT to transforn yahoo
shopping search result to html. my problem is the return XML contain
xmlns in root element, here is the sample xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="aproducts earch.xslt"?>
<ProductSearc h xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yaho o:aprods" xsi:schemaLocat ion="urn:yahoo: aprods
http://api.shopping.ya hoo.com/shoppingservice/v2/aproductsearch. xsd">
............... ....
</ProductSearch>
I am testing my xslt file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" omit-xml-
declaration="ye s"
indent="yes"/>
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR>
<TD>From</TD>
<TD>To</TD>
</TR>
<xsl:for-each select="Product Search/
Products/Product">
<TR>
<TD>
<xsl:value-of
select="Catalog/PriceFrom"/>
</TD>
<TD>
<xsl:value-of
select="Catalog/PriceTo"/>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
if I remove the xmlns="urn:yaho o:aprods" from the XML, then the xslt
works fine, otherwise, nothing shows up. I don't know what is the
problem of my xslt file.
Thanks a lot! 2 9506
"Lee" <le************ @gmail.comwrote in message
news:11******** **************@ o5g2000hsb.goog legroups.com...
Hello guys, I am new to XML and working on a XSLT to transforn yahoo
shopping search result to html. my problem is the return XML contain
xmlns in root element, here is the sample xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="aproducts earch.xslt"?>
<ProductSearc h xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yaho o:aprods" xsi:schemaLocat ion="urn:yahoo: aprods
http://api.shopping.ya hoo.com/shoppingservice/v2/aproductsearch. xsd">
............... ...
</ProductSearch>
I am testing my xslt file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" omit-xml-
declaration="ye s"
indent="yes"/>
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR>
<TD>From</TD>
<TD>To</TD>
</TR>
<xsl:for-each select="Product Search/
Products/Product">
Your problem is that the input XML contains a namespace, but you aren't
using it. Add something like xmlns:yahoo="ur n:yahoo:aprods" in the
<xsl:stylesheet element, and in your stylesheet itself, use things like
select="yahoo:P roductSearch/yahoo:Products/yahoo:Product".
John
On Apr 3, 4:17 pm, "John Saunders" <john.saunder s at trizetto.com>
wrote:
"Lee" <lee.jenkins... @gmail.comwrote in message
news:11******** **************@ o5g2000hsb.goog legroups.com...
Hello guys, I am new to XML and working on a XSLT to transforn yahoo
shopping search result to html. my problem is the return XML contain
xmlns in root element, here is the sample xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="aproducts earch.xslt"?>
<ProductSearc h xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yaho o:aprods" xsi:schemaLocat ion="urn:yahoo: aprods
http://api.shopping.ya hoo.com/shoppingservice/v2/aproductsearch. xsd">
............... ...
</ProductSearch>
I am testing my xslt file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" omit-xml-
declaration="ye s"
indent="yes"/>
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR>
<TD>From</TD>
<TD>To</TD>
</TR>
<xsl:for-each select="Product Search/
Products/Product">
Your problem is that the input XML contains a namespace, but you aren't
using it. Add something like xmlns:yahoo="ur n:yahoo:aprods" in the
<xsl:stylesheet element, and in your stylesheet itself, use things like
select="yahoo:P roductSearch/yahoo:Products/yahoo:Product".
John- Hide quoted text -
- Show quoted text -
John,
Thank you very much, it works perfect. at the very beginning I tried
add namespace to my xslt file, but I used a wrong name space. Thanks a
lot! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David Furey |
last post by:
Hi
I have an XML documnet and a XSLT document as shown below
THe XSLT document brings back a filtered docmument that has the VendorName
that starts with a particular sub-string
This works as expected with alphabet and number characters and the ' (single
quote ' entity) character but does not work if a double quote character
" is part of the string to filter on
This returns all Vendor Names that begin with A (either case)
|
by: Gustavo L. Fabro |
last post by:
Greetings!
I'm testing VS 2005 Beta 2, and I've compiled a program that
runs just fine on my computer (where VS is installed).
I've tried to run this same program on another computer
(after having installed MS .NET Framework 2.0 Beta 2 on it,
from
http://www.microsoft.com/downloads/details.aspx?FamilyId=7ABD8C8F-287E-4C7E-9A4A-A4ECFF40FC8E&displaylang=en),
but got the following message:
|
by: chaf2701 |
last post by:
Hi,
I was in trouble with the System.Windows.Forms.ImageList control from
VC.NET. I was doing the following :
1. New Project, C#, Windows Application
2. Add ImageList component imageList1 to Form1
3. in imageList1 properties open the 'Image Collection Editor' for
Images
and add a simple copy.bmp
|
by: Kevin Mitchell |
last post by:
I have an NT shared hosting account, but the provider names the script/write
folder cgi-bin. I want to place DLLs in the cgi-bin directory and get them
to work in my Web applications.
What do I need to do to get my application to look for DLLs in the cgi-bin
folder instead of the default bin folder?
Can I expect success in getting DLLs to work in this way -- or, do I need to
upgrade from a shared hosting to a dedicated server account?
|
by: MSDNAndi |
last post by:
Hi,
I have a set of simple webservices calls that worked fine using .NET
Framework 1.0.
I am calling a Java/Apache based webservices, the calling side is not able
to supply a proper WSDL.
What it does is to call a webservice with two parameters, one being a
integer, the other one being a "String" which contains XML (not the best
practice, however that is the target interface and we cannot change that).
| |
by: R. Ian Lee |
last post by:
I've built an XSLT file that transforms data to SpreadsheetML format. The
XSLT uses a <xsl:call-template/to build each worksheet. For some reason,
when I transform the file, it is inserting xmlns="" attributes into my
<Worksheetelements which causes the worksheet not to work with Excel. I'm
using the System.Xml.Xsl.XslTransform class to perform the transform. Here's
a snippet of the XSLT template that is called:
<xsl:template...
|
by: Chris |
last post by:
Hi,
I installed Visual Studio 2005 SP1, my application does not start on
machines without Visual Studio installed any more. It was working without
SP1.
After searching the web, it seems caused by manifest file, I changed link
option to generate external manifest file. The manifest lists dependency to
two version of CRTs, is that the problem and why it lists both?
|
by: Lee |
last post by:
Hello guys, I am new to XML and working on a XSLT to transforn yahoo
shopping search result to html. my problem is the return XML contain
xmlns in root element, here is the sample xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="aproductsearch.xslt"?>
<ProductSearch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yahoo:aprods" xsi:schemaLocation="urn:yahoo:aprods...
|
by: ShadowLocke |
last post by:
Hi,
Im not very experienced with XSL, this is my first run in with it. I found an XSL file that converts a dataset to an excel readable format.
The problem I have is when the dataset has a null value for a column, it does not add an empty element for the column. Is there any way I can detect this?
Excel.xsl:
<xsl:stylesheet version="1.0"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |