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.

Probably a simple issue (XSLT)

Featured Replies

Hi all - Very much a newbie to XML/XSLT in Filemaker, so I'm not even sure if I will be supplying the proper info here. I'm trying to create a stylesheet in order to import data from a file that has info formatted like this:

PS3569.T3868

C79 1999

Assuming I want the PS3569.T3868 info imported, how do I reference just that field in the stylesheet? I've played around with variations of this:

and

But these don't seem to work (the second one returns just the letter "a" but it makes me feel like I'm on to something ;)

Thanks in advance for advice and help. Again, I'm very new to this so let me know if more details are required.

It should look approximately* like this:

See the 'Predicates' section here:

http://www.w3schools.com/XPath/xpath_syntax.asp

---

(*) I cannot tell the path to the element without seeing the entire document. In general, it's more efficient to specify the path explicitly instead of using the "wherever" // axis.

  • Author

Thanks so much for the response. I will try your suggestions. Also thank you for including the link, that is going to be very helpful as well.

FYI - here is the full XML file that I'm working with...

bibliographic.zip

You might also want to look at dealing with a somewhat similar structure in this thread:

http://fmforums.com/forum/showtopic.php?tid/209700/

  • Author

Sorry to have to come back to the well on this one but I just can't seem to get this import to work.

I'm attaching both my original XML file and my attempts at building an appropriate XSLT file. I have modified the "xsl:value-of select=" tag about 200 times in an attempt to import the data that lives in the datafield/subfield tags in the XML file.

I either import too much (all the content, in one big dump) or nothing at all. I've included (commented out) some of my attempts to point to these fields. For those who don't want to open the zip file here's the first part of the XML file:

<?xml version="1.0"?>

1.19marcxmlxml

00793pam a2200241 a 4500

6750948

BIBLIOS

20031223191706.0

990108s1999 nyu 000 1 eng

99011685

0380973464 (hardcover) ;)

$27.50 ($39.50 Can.)

(DLC) 99011685

DLC

DLC

DLC

BIBLIOS

PS3569.T3868

C79 1999

And my attempts to grab the "PS3569.T3868" data have looked (at various times) like this:

None of these get what I want which is just that one piece of info. Note - eventually if I figure this one field out I would want to use it for the rest of the XML file to import all the subfields in to their appropriate slot.

Any help would be eternally appreciated! THanks in advance!

  • Author

after all that, forgot to attach the file!

bibliofile.zip

Yeah, well - you've got another issue there: the namespace changes at some point of the hierarchy:

So and all its chidren, incl. and , belong to another namespace. I often wonder why some XML authors need this complexity. Anyway, you need to add this namespace to your element and give it a prefix, say "sl":

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:zs="http://www.loc.gov/zing/srw/"

xmlns:sl="http://www.loc.gov/MARC21/slim"

exclude-result-prefixes="zs sl">

Then you can use it in your path as:


Note that a record (i.e. a sl:record) has many datafield elements, so this will get data from the first one that has a subfield coded "a". What you really should be doing is specify the datafield by its tag attribute.

  • Author

By jove it works!

THANK YOU SO MUCH. This seriously makes my day/week/month/year. Plus I feel like I know a lot more about XML/XSLT than when I started, which is a big plus.

Thank you thank you thank you!

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.