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.
<b>XML Document:</b>
<?xml version="1.0" encoding="UTF8" ?>
<?xml-stylesheet type="text/xsl" href="eBayProdu ctSearchXSL.xsl "?>
<GetSearchResul tsResponse xmlns="urn:ebay :apis:eBLBaseCo mponents">
<Timestamp>2007 0223T11:24:27.1 56Z</Timestamp>
<Ack>Success</Ack>
<Version>497</Version>
<Build>e497_cor e_Bundled_41658 06_R1</Build>
<SearchResultIt emArray>
<SearchResultIt em>
<Item>
<ItemID>1100161 75514</ItemID>
<ListingDetails >
<StartTime>2007 0216T11:35:58.0 00Z</StartTime>
<EndTime>200702 23T11:35:58.000 Z</EndTime>
<ViewItemURL>ht tp://rover.ebay.com/rover/1/711629429780/1?
AID=10381315&PI D=2113604&loc=h ttp://cgi.sandbox.eba y.com/ws/
eBayISAPI.dll%3 FViewItem%26ite m%3D11001617551 4%26ih%3D001%26 category
%3D80653%26rd%3 D1&sid=1863066 </ViewItemURL>
</ListingDetails>
<SellingStatu s>
<BidCount>0</BidCount>
<CurrentPrice currencyID="USD ">111.0</CurrentPrice>
</SellingStatus>
<Site>eBayMotor s</Site>
<Title>This is a test ITEM DO NOT BID re1</Title>
<Currency>USD </Currency>
<ListingType>Fi xedPriceItem</ListingType>
<GiftIcon>0</GiftIcon>
<SubTitle />
<Country>US</Country>
<Storefront>
<StoreCategoryI D>0</StoreCategoryID >
<StoreCategory2 ID>0</StoreCategory2I D>
<StoreURL>htt p://stores.sandbox. ebay.com/id=397607</StoreURL>
<StoreName>Kris hna's Store</StoreName>
</Storefront>
<PostalCode>441 24</PostalCode>
<ShippingDetail s>
<ShippingType>N otSpecified</ShippingType>
</ShippingDetails >
<PictureDetails >
<GalleryType>Ga llery</GalleryType>
<GalleryURL>htt p://thumbs.ebay.com/pict/110016175514.jp g</GalleryURL>
</PictureDetails>
<ListingDuratio n>Days_7</ListingDuration >
</Item>
<SearchResultVa lues>Picture</SearchResultVal ues>
</SearchResultIte m>
</SearchResultIte mArray>
<ItemsPerPage>1 </ItemsPerPage>
<PageNumber>1 </PageNumber>
<HasMoreItems>t rue</HasMoreItems>
<PaginationResu lt>
<TotalNumberOfP ages>1412</TotalNumberOfPa ges>
<TotalNumberOfE ntries>1412</TotalNumberOfEn tries>
</PaginationResul t>
<CategoryArra y />
</GetSearchResult sResponse>
<b>XSL:</b>
<?xml version="1.0" encoding="utf-8" ?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:urn="urn: ebay:apis:eBLBa seComponents">
<xsl:output method="xml"/>
<xsl:template match="/">
<ResultSet>
<xsl:attribut e name="firstPosi tion"><xsl:valu e-of
select="GetSear chResultsRespon se/PaginationResul t/TotalNumberOfPa ges" /
></xsl:attribute>
<xsl:attribut e name="TotalAvai lable"><xsl:val ue-of
select="GetSear chResultsRespon se/PaginationResul t/
TotalNumberOfEn tries" /></xsl:attribute>
<xsl:for-each select="GetSear chResultsRespon se/
SearchResultIte mArray/SearchResultIte m/Item">
<Item>
<xsl:element name="Id"><xsl: value-of select="ItemID" /></
xsl:element>
<xsl:element name="Title"><x sl:value-of select="Title" /></
xsl:element>
</Item>
</xsl:for-each>
</ResultSet>
</xsl:template>
</xsl:stylesheet>
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.
<b>XML Document:</b>
<?xml version="1.0" encoding="UTF8" ?>
<?xml-stylesheet type="text/xsl" href="eBayProdu ctSearchXSL.xsl "?>
<GetSearchResul tsResponse xmlns="urn:ebay :apis:eBLBaseCo mponents">
<Timestamp>2007 0223T11:24:27.1 56Z</Timestamp>
<Ack>Success</Ack>
<Version>497</Version>
<Build>e497_cor e_Bundled_41658 06_R1</Build>
<SearchResultIt emArray>
<SearchResultIt em>
<Item>
<ItemID>1100161 75514</ItemID>
<ListingDetails >
<StartTime>2007 0216T11:35:58.0 00Z</StartTime>
<EndTime>200702 23T11:35:58.000 Z</EndTime>
<ViewItemURL>ht tp://rover.ebay.com/rover/1/711629429780/1?
AID=10381315&PI D=2113604&loc=h ttp://cgi.sandbox.eba y.com/ws/
eBayISAPI.dll%3 FViewItem%26ite m%3D11001617551 4%26ih%3D001%26 category
%3D80653%26rd%3 D1&sid=1863066 </ViewItemURL>
</ListingDetails>
<SellingStatu s>
<BidCount>0</BidCount>
<CurrentPrice currencyID="USD ">111.0</CurrentPrice>
</SellingStatus>
<Site>eBayMotor s</Site>
<Title>This is a test ITEM DO NOT BID re1</Title>
<Currency>USD </Currency>
<ListingType>Fi xedPriceItem</ListingType>
<GiftIcon>0</GiftIcon>
<SubTitle />
<Country>US</Country>
<Storefront>
<StoreCategoryI D>0</StoreCategoryID >
<StoreCategory2 ID>0</StoreCategory2I D>
<StoreURL>htt p://stores.sandbox. ebay.com/id=397607</StoreURL>
<StoreName>Kris hna's Store</StoreName>
</Storefront>
<PostalCode>441 24</PostalCode>
<ShippingDetail s>
<ShippingType>N otSpecified</ShippingType>
</ShippingDetails >
<PictureDetails >
<GalleryType>Ga llery</GalleryType>
<GalleryURL>htt p://thumbs.ebay.com/pict/110016175514.jp g</GalleryURL>
</PictureDetails>
<ListingDuratio n>Days_7</ListingDuration >
</Item>
<SearchResultVa lues>Picture</SearchResultVal ues>
</SearchResultIte m>
</SearchResultIte mArray>
<ItemsPerPage>1 </ItemsPerPage>
<PageNumber>1 </PageNumber>
<HasMoreItems>t rue</HasMoreItems>
<PaginationResu lt>
<TotalNumberOfP ages>1412</TotalNumberOfPa ges>
<TotalNumberOfE ntries>1412</TotalNumberOfEn tries>
</PaginationResul t>
<CategoryArra y />
</GetSearchResult sResponse>
<b>XSL:</b>
<?xml version="1.0" encoding="utf-8" ?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:urn="urn: ebay:apis:eBLBa seComponents">
<xsl:output method="xml"/>
<xsl:template match="/">
<ResultSet>
<xsl:attribut e name="firstPosi tion"><xsl:valu e-of
select="GetSear chResultsRespon se/PaginationResul t/TotalNumberOfPa ges" /
></xsl:attribute>
<xsl:attribut e name="TotalAvai lable"><xsl:val ue-of
select="GetSear chResultsRespon se/PaginationResul t/
TotalNumberOfEn tries" /></xsl:attribute>
<xsl:for-each select="GetSear chResultsRespon se/
SearchResultIte mArray/SearchResultIte m/Item">
<Item>
<xsl:element name="Id"><xsl: value-of select="ItemID" /></
xsl:element>
<xsl:element name="Title"><x sl:value-of select="Title" /></
xsl:element>
</Item>
</xsl:for-each>
</ResultSet>
</xsl:template>
</xsl:stylesheet>
Comment