有人能告诉我xslt样式表需要什么才能对这个xml文件进行样式设置吗:
<?xml version="1.0" encoding="UTF-8"?>
<BrowseNodeLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<OperationRequest>
<HTTPHeaders>
<Header Name="UserAgent" Value="Jakarta Commons-HttpClient/3.0.1">
</Header>
</HTTPHeaders>
<RequestId>09ZDHZ7PV71DC7Z168WA</RequestId>
<Arguments>
<Argument Name="AssociateTag" Value="xxxxx"></Argument>
<Argument Name="Service" Value="AWSECommerceService"></Argument>
<Argument Name="SubscriptionId" Value="yyyyy"></Argument>
<Argument Name="Signature" Value="zzzzz"></Argument>
<Argument Name="ResponseGroup" Value="NewReleases"></Argument>
<Argument Name="Operation" Value="BrowseNodeLookup"></Argument>
<Argument Name="BrowseNodeId" Value="676410011"></Argument>
<Argument Name="Timestamp" Value="2012-03-03T16:37:17Z"></Argument>
</Arguments>
<RequestProcessingTime>0.0326540470123291</RequestProcessingTime>
</OperationRequest>
<BrowseNodes>
<Request>
<IsValid>True</IsValid>
<BrowseNodeLookupRequest>
<BrowseNodeId>676410011</BrowseNodeId>
<ResponseGroup>NewReleases</ResponseGroup>
</BrowseNodeLookupRequest>
</Request>
<BrowseNode>
<BrowseNodeId>676410011</BrowseNodeId>
<Name>Games</Name>
<NewReleases>
<NewRelease>
<ASIN>B0073POVPK</ASIN>
<Title>Pokepark 2: Wonders Beyond (Wii)</Title>
</NewRelease>
<NewRelease>
<ASIN>B0076X58XI</ASIN>
<Title>Back to the Future: The Game (Wii)</Title>
</NewRelease>
</NewReleases>
<TopItemSet>
<Type>NewReleases</Type>
<TopItem>
<ASIN>B0073POVPK</ASIN>
<Title>Pokepark 2: Wonders Beyond (Wii)</Title>
<DetailPageURL>http://www.amazon.co.uk/Pokepark-2-Wonders-Beyond-Wii-Nintendo/dp/B0073POVPK%3FSubscriptionId%3D116AQMJ35GESH5XBF1G2%26tag%3Dwii07-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0073POVPK</DetailPageURL>
<ProductGroup>Video Games</ProductGroup>
</TopItem>
<TopItem>
<ASIN>B0076X58XI</ASIN>
<Title>Back to the Future: The Game (Wii)</Title>
<DetailPageURL>http://www.amazon.co.uk/Back-Future-Game-Wii-Nintendo/dp/B0076X58XI%3FSubscriptionId%3D116AQMJ35GESH5XBF1G2%26tag%3Dwii07-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB0076X58XI</DetailPageURL>
<ProductGroup>Video Games</ProductGroup>
</TopItem>
</TopItemSet>
</BrowseNode>
</BrowseNodes>
</BrowseNodeLookupResponse>
完整的文件在这里-http://www.wiiuser.co.uk/XML_Games_NR1_original.xml
所以它看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<xml xmlns:aws="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<root>
<NewRelease>
<asin>B0073POVPK</asin>
<Title>Pokepark 2: Wonders Beyond (Wii)</Title>
</NewRelease>
<NewRelease>
<asin>B0076X58XI</asin>
<Title>Back to the Future: The Game (Wii)</Title>
</NewRelease>
</root>
</xml>
完整的输出文件在这里-http://www.wiiuser.co.uk/XML_Games_NR1_styled.xml
我知道我在这里寻求很多帮助,我通常不会请求,但我真的很困,几天来一直在努力让它发挥作用。我相信对于那些知道如何做的人来说,这很简单,但不幸的是,我不是其中之一。
请不要因为我问这个而贬低我。
提前感谢您提供的任何帮助。
这是我在亚马逊更改模式之前使用的xslt文件,但现在它不起作用了。也许之前它有问题,但模式更改影响了它。
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aws="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xml>
<root>
<xsl:apply-templates select="aws:BrowseNodeLookupResponse/BrowseNodes/BrowseNode/NewReleases/NewRelease" />
</root>
</xml>
</xsl:template>
<xsl:template match="aws:NewRelease">
<NewRelease>
<asin>
<xsl:value-of select="aws:ASIN" />
</asin>
<Title>
<xsl:value-of select="aws:Title" />
</Title>
</NewRelease>
</xsl:template>
</xsl:stylesheet>
您必须在应用模板的"select"属性中指定xpath的所有步骤上的名称空间:
<xsl:apply-templates select="aws:BrowseNodeLookupResponse/aws:BrowseNodes/aws:BrowseNode/aws:NewReleases/aws:NewRelease"/>