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
http://api.shopping.yahoo.com/shoppingservice/v2/aproductsearch.xsd">
...................
</ProductSearch>
I am testing my xslt file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" omit-xml-
declaration="yes"
indent="yes"/>
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR>
<TD>From</TD>
<TD>To</TD>
</TR>
<xsl:for-each select="ProductSearch/
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:yahoo: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 9464
"Lee" <le************@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.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="aproductsearch.xslt"?>
<ProductSearch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yahoo:aprods" xsi:schemaLocation="urn:yahoo:aprods
http://api.shopping.yahoo.com/shoppingservice/v2/aproductsearch.xsd">
..................
</ProductSearch>
I am testing my xslt file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" omit-xml-
declaration="yes"
indent="yes"/>
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR>
<TD>From</TD>
<TD>To</TD>
</TR>
<xsl:for-each select="ProductSearch/
Products/Product">
Your problem is that the input XML contains a namespace, but you aren't
using it. Add something like xmlns:yahoo="urn:yahoo:aprods" in the
<xsl:stylesheetelement, and in your stylesheet itself, use things like
select="yahoo:ProductSearch/yahoo:Products/yahoo:Product".
John
On Apr 3, 4:17 pm, "John Saunders" <john.saunders at trizetto.com>
wrote:
"Lee" <lee.jenkins...@gmail.comwrote in message
news:11**********************@o5g2000hsb.googlegro ups.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="aproductsearch.xslt"?>
<ProductSearch xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:yahoo:aprods" xsi:schemaLocation="urn:yahoo:aprods
http://api.shopping.yahoo.com/shoppingservice/v2/aproductsearch.xsd">
..................
</ProductSearch>
I am testing my xslt file:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" omit-xml-
declaration="yes"
indent="yes"/>
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR>
<TD>From</TD>
<TD>To</TD>
</TR>
<xsl:for-each select="ProductSearch/
Products/Product">
Your problem is that the input XML contains a namespace, but you aren't
using it. Add something like xmlns:yahoo="urn:yahoo:aprods" in the
<xsl:stylesheetelement, and in your stylesheet itself, use things like
select="yahoo:ProductSearch/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...
|
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...
|
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...
|
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...
|
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.
...
|
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...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
|
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...
|
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...
| |