Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having trouble with XSLT and this XML file...??? Very basic.

Status
Not open for further replies.

angelleye

Technical User
Feb 4, 2003
36
US
I'm new to XSLT (just got into XML and have been using XML DOM with ASP) and I'm trying to display this response I get back from the eBay API.

The response I get is this:

<?xml version="1.0" encoding="UTF-8"?>
<GeteBayOfficialTimeResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2005-08-12T02:33:09.184Z</Timestamp>
<Ack>Success</Ack>
<CorrelationID>00000000-00000000-00000000-00000000-00000000-00000000-0000000000</CorrelationID>
<Version>421</Version>
<Build>e421_core_Bundled_1630320_R1</Build>
</GeteBayOfficialTimeResponse>


I've setup a very basic XSLT file to try and display the page but I'm having issues because of the xmlns=... attribute on the GeteBayOfficialTimeResponse element. My .xsl file is as such:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="
<xsl:template match="/">
<html>
<body bgcolor="cccccc">
<p><xsl:value-of select="GeteBayOfficialTimeResponse/Timestamp"/></p>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

When I link to that .xsl file from my .xml and open it up I get a blank gray page. If I remove the attribute from the GeteBayOfficialTimeResponse element and try it it displays the Timestamp value perfectly.

What do I need to do to handle that attribute on the root element? I can't find anything about this at w3schools.com or any other tutorial sites. Any information would be greatly appreciated. Thanks!
 
Ok, I've gotten that part figured out. Now I'm on to a little more complex situation.

I'm using XSLT to transform an XML document into an HTML form with hidden elements so that I can populate an Access database with ASP. I'm getting stuck on how to select the value of a child element.

Here is my XML:
I've succesfully grabbed the <ItemID>, <StartTime>, and <EndTime> values, but I'm having trouble with the <Fee> elements. I need to select the value of the <Fee> child element to the <Fee> element with <Name> element ListingFee...if that makes any sense. Basically, looking at the XML, I need to get the value of the ListingFee. I've tried many things, currently I got stuck after trying:

<input type="hidden" name="ListingFee">
<xsl:attribute name="value">
<xsl:when test="/b:Name=ListingFee">
<xsl:value-of select="//b:AddItemResponse/b:Fees/b:Fee"/>
</xsl:when>
</xsl:attribute>
</input>

You can look at my entire XSL here:
Any information on how to make this selection would be fabulous. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top