I am attempting to write an XSL file to transform the orignal XML
document to only show the elements I need. I have a problem though,
the XML document contains an xmlns "urn" which when present means my
XSL file does not work and shows nothing. What I am doing wrong? I am
newbie to all of this so any help would be great.
XML Document:
XSL:
document to only show the elements I need. I have a problem though,
the XML document contains an xmlns "urn" which when present means my
XSL file does not work and shows nothing. What I am doing wrong? I am
newbie to all of this so any help would be great.
XML Document:
Code:
<?xml version="1.0" encoding="UTF8" ?> <?xml-stylesheet type="text/xsl" href="eBayProductSearchXSL.xsl"?> <GetSearchResultsResponse [B]xmlns="urn:ebay:apis:eBLBaseComponents"[/B]> <Timestamp>20070223T11:24:27.156Z</Timestamp> <Ack>Success</Ack> <Version>497</Version> <Build>e497_core_Bundled_4165806_R1</Build> <SearchResultItemArray> <SearchResultItem> <Item> <ItemID>110016175514</ItemID> <ListingDetails> <StartTime>20070216T11:35:58.000Z</StartTime> <EndTime>20070223T11:35:58.000Z</EndTime> <ViewItemURL>http://rover.ebay.com/rover/1/711629429780/1? AID=10381315&PID=2113604&loc=http://cgi.sandbox.ebay.com/ws/ eBayISAPI.dll%3FViewItem%26item%3D110016175514%26ih%3D001%26category %3D80653%26rd%3D1&sid=1863066</ViewItemURL> </ListingDetails> <SellingStatus> <BidCount>0</BidCount> <CurrentPrice currencyID="USD">111.0</CurrentPrice> </SellingStatus> <Site>eBayMotors</Site> <Title>This is a test ITEM DO NOT BID re1</Title> <Currency>USD</Currency> <ListingType>FixedPriceItem</ListingType> <GiftIcon>0</GiftIcon> <SubTitle /> <Country>US</Country> <Storefront> <StoreCategoryID>0</StoreCategoryID> <StoreCategory2ID>0</StoreCategory2ID> <StoreURL>http://stores.sandbox.ebay.com/id=397607</StoreURL> <StoreName>Krishna's Store</StoreName> </Storefront> <PostalCode>44124</PostalCode> <ShippingDetails> <ShippingType>NotSpecified</ShippingType> </ShippingDetails> <PictureDetails> <GalleryType>Gallery</GalleryType> <GalleryURL>http://thumbs.ebay.com/pict/110016175514.jpg</GalleryURL> </PictureDetails> <ListingDuration>Days_7</ListingDuration> </Item> <SearchResultValues>Picture</SearchResultValues> </SearchResultItem> </SearchResultItemArray> <ItemsPerPage>1</ItemsPerPage> <PageNumber>1</PageNumber> <HasMoreItems>true</HasMoreItems> <PaginationResult> <TotalNumberOfPages>1412</TotalNumberOfPages> <TotalNumberOfEntries>1412</TotalNumberOfEntries> </PaginationResult> <CategoryArray /> </GetSearchResultsResponse>
Code:
<?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:urn="urn:ebay:apis:eBLBaseComponents"> <xsl:output method="xml"/> <xsl:template match="/"> <ResultSet> <xsl:attribute name="firstPosition"><xsl:value-of select="GetSearchResultsResponse/PaginationResult/TotalNumberOfPages" / ></xsl:attribute> <xsl:attribute name="TotalAvailable"><xsl:value-of select="GetSearchResultsResponse/PaginationResult/ TotalNumberOfEntries" /></xsl:attribute> <xsl:for-each select="GetSearchResultsResponse/ SearchResultItemArray/SearchResultItem/Item"> <Item> <xsl:element name="Id"><xsl:value-of select="ItemID" /></ xsl:element> <xsl:element name="Title"><xsl:value-of select="Title" /></ xsl:element> </Item> </xsl:for-each> </ResultSet> </xsl:template> </xsl:stylesheet>
Comment