Guten Tag zusammen,
ich spiele momentan etwas mit dem AmazonWebservice herum und wollte nun mal die Style-Option testen, über die man zu einer eigenen XSL-Definition verweisen kann, welche dann zur Verarbeitung der XML-Antwort herangezogen wird. Soweit so gut, jedoch funktioniert meine for-each Schleife nicht.
Hier der Aufbau der XML-Datei:
Nun habe ich dazu folgende XSL-Definition erstellt:
jedoch läuft die for-each Schleife wie gesagt nicht durch, sprich ich bekomme eine leere Tabelle gezeigt. Wo liegt mein Fehler?
Mit freundlichen Grüßen
Sebastian
ich spiele momentan etwas mit dem AmazonWebservice herum und wollte nun mal die Style-Option testen, über die man zu einer eigenen XSL-Definition verweisen kann, welche dann zur Verarbeitung der XML-Antwort herangezogen wird. Soweit so gut, jedoch funktioniert meine for-each Schleife nicht.
Hier der Aufbau der XML-Datei:
Code:
− <ItemSearchResponse> − <OperationRequest> − <HTTPHeaders> <Header Name="UserAgent" Value="Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"/> </HTTPHeaders> <RequestId>1A2QMNTTJW9A9AMHTQFC</RequestId> − <Arguments> <Argument Name="SearchIndex" Value="Books"/> <Argument Name="Service" Value="AWSECommerceService"/> <Argument Name="Keywords" Value="XSL"/> <Argument Name="Operation" Value="ItemSearch"/> <Argument Name="AWSAccessKeyId" Value="***************"/> </Arguments> <RequestProcessingTime>0.101448059082031</RequestProcessingTime> </OperationRequest> − <Items> − <Request> <IsValid>True</IsValid> − <ItemSearchRequest> <Keywords>XSL</Keywords> <SearchIndex>Books</SearchIndex> </ItemSearchRequest> </Request> <TotalResults>38</TotalResults> <TotalPages>4</TotalPages> − <Item> <ASIN>3935042914</ASIN> − <DetailPageURL> http://www.amazon.de/gp/redirect.htm...6DZPASY62Z2DR2 </DetailPageURL> − <ItemAttributes> <Author>Tobias Hauser</Author> <Creator Role="Autor">Tobias Hauser</Creator> <Manufacturer>Entwickler.Press</Manufacturer> <ProductGroup>Book</ProductGroup> <Title>XML Standards. schnell + kompakt</Title> </ItemAttributes> </Item> . . .
Code:
<?xml version="1.0" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict"> <xsl:template match="/"> <table border="1"> <tr><td>ASIN</td> <td>URL</td> <td>Name</td></tr> <xsl:for-each select="Items/Item"> <tr> <td><xsl:value-of select="ASIN" /></td> <td><xsl:value-of select="DetailPageURL" /></td> <td><xsl:value-of select="ItemAttributes/Title" /></td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet>
Mit freundlichen Grüßen
Sebastian
Comment