April 21, 201114 yr :bang: Once again after hours of playing and trying to learn I just can't seem to get it! I know it's not that hard so if someone will point me in the right direction I'd appreciate it. The attached is a basic XSL style sheet and example from which I can apply my new found knowledge (I hope) to my others. I only want to import from the xml response certain records into my database and ignore the rest. So basically I only want to import those matching certain predefined criteria Examples: PublicationDate=Jan 2011 or ProductGroup=Books or Format=DVD I believe it will involve the 'for-each' but I'm not sure where. ?? and does it involve the template match also? Help? amazon_info_search_filtering_zipped.zip
April 22, 201114 yr It would be easier if we had an example of the XML source (i.e. the response from Amazon). In general, lookup some information about "xpath predicates".
April 22, 201114 yr Author It would be easier if we had an example of the XML source (i.e. the response from Amazon). In general, lookup some information about "xpath predicates". Will do. However I'm not a programmer so hopefully it'll make some sense.... Trying to upload a sample but it wont go though yet. Sorry I forgot to include it before.
April 22, 201114 yr Author Will do. However I'm not a programmer so hopefully it'll make some sense.... Trying to upload a sample but it wont go though yet. Sorry I forgot to include it before. Finally !! variations_xml.zip
April 23, 201114 yr I believe that if you change your main selector to: ... <xsl:for-each select="amz:ItemLookupResponse/amz:Items/amz:Item[amz:ItemAttributes/amz:Format='DVD' or amz:ItemAttributes/amz:ProductGroup='Books' or substring(amz:ItemAttributes/amz:PublicationDate,1,7)='2011-01']"> <ROW> ... it should work. Hard to test with your data.
April 23, 201114 yr Author I believe that if you change your main selector to: ... <xsl:for-each select="amz:ItemLookupResponse/amz:Items/amz:Item[amz:ItemAttributes/amz:Format='DVD' or amz:ItemAttributes/amz:ProductGroup='Books' or substring(amz:ItemAttributes/amz:PublicationDate,1,7)='2011-01']"> <ROW> ... it should work. Hard to test with your data. Thank you! I had the basic form but I forgot to add the 'amz:' before itemAttributes and Format!! I thought I was just way off base so I left that out of the upload......... Here's a basic final for anyone needing it. Side note: The actual product group should have been singular Book instead of Books. Also now I just need to figure out how to pass a variable into it (if that's even possible) instead of separate XSL's for each. Say 1 for Book, 1 for DVD, etc... amazon_info_search_alternateversions_Filtered_upload.zip
April 23, 201114 yr Author I believe that if you change your main selector to: ... <xsl:for-each select="amz:ItemLookupResponse/amz:Items/amz:Item[amz:ItemAttributes/amz:Format='DVD' or amz:ItemAttributes/amz:ProductGroup='Books' or substring(amz:ItemAttributes/amz:PublicationDate,1,7)='2011-01']"> <ROW> ... it should work. Hard to test with your data. One last thing... 'cause I'm trying but it aint working. IF I need to match an either to 1 or 2 and a then 1 how does it go??? Like maybe I want all PaperBack books and Audio CD's under 1000 sales rank.......... <xsl:for-each select="amz:ItemLookupResponse/amz:Items/amz:Item[amz:ItemAttributes/amz:Binding='Paperback' or amz:ItemAttributes/amz:Binding='Audio CD' and amz:SalesRank<1000]"> ???
April 24, 201114 yr IF I need to match an either to 1 or 2 and a then 1 how does it go??? I am not sure what that means... Perhaps: ...[amz:ItemAttributes/amz:Binding='Paperback' or amz:ItemAttributes/amz:Binding='Audio CD'] [amz:SalesRank<1000]"> Please have mercy upon those of us trying to answer and proof-read your posts. now I just need to figure out how to pass a variable Maybe you should write to Filemaker, Inc. about this. The XSLT processor DOES allow for a 'parameter' to be passed to it - but FMI's implementation didn't provide access to this feature.
April 24, 201114 yr Author I am not sure what that means... Perhaps: ...[amz:ItemAttributes/amz:Binding='Paperback' or amz:ItemAttributes/amz:Binding='Audio CD'] [amz:SalesRank<1000]"> Please have mercy upon those of us trying to answer and proof-read your posts. Maybe you should write to Filemaker, Inc. about this. The XSLT processor DOES allow for a 'parameter' to be passed to it - but FMI's implementation didn't provide access to this feature. My apologies.... What I should have said was if I only wanted Paperbacks under 1000 salesrank and Audio CD's under 1000 salesrank ...... but nothing else. I ended up putting the salesrank FIRST, an 'and' ... then the 'or' ... like so: .....amz:Item[amz:='SalesRank' and amz:ItemAttributes/amz:Binding='Audio CD' or amz:ItemAttributes/amz:Binding='Paperback']"> HOWEVER ... mine is probably incorrect structure but it did work. THANK YOU FOR YOUR HELP !!!
Create an account or sign in to comment