Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using XSL style sheet to filter records to import

Featured Replies

: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

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".

  • 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.

  • 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

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.

  • 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

  • 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]">

?????????

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.

  • 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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.