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.

Importing from a repeating field in an onix xml file

Featured Replies

  • Newbies

Hi all, 

I have modified a solution I found in these forums to put together this StylesheetZD2.xsl to extract data from the attached input file AUSdelta152761211111.xml (onix), but I am having trouble figuring out how to import data from a repeating field.

For example, with this stylesheet I can only extract the first "contributor"

<COL><DATA><xsl:value-of select="contributor/b035"/></DATA></COL>
<COL><DATA><xsl:value-of select="contributor/b038"/></DATA></COL>
<COL><DATA><xsl:value-of select="contributor/b039"/></DATA></COL>
<COL><DATA><xsl:value-of select="contributor/b040"/></DATA></COL>
<COL><DATA><xsl:value-of select="contributor/professionalaffiliation/b046"/></DATA></COL>
<COL><DATA><xsl:value-of select="contributor/b044"/></DATA></COL>

But in the example below there are 4 contributors with the same tags.


<contributor>

<b035>A01</b035>

<b039>E A</b039>

<b040>Wrigley</b040>


<persondate>

<b305>007</b305>

<j260>05</j260>

<b306>1931</b306>

</persondate>


<professionalaffiliation>

<b046>University of Cambridge All Souls College, Oxford All Souls College, Oxford All Souls College, Oxford University of Cambridge University of Cambridge University of Cambridge University of Cambridge University of Cambridge All Souls College, Oxford</b046>

</professionalaffiliation>

<b044>Sir Tony Wrigley is a member and co-founder of the Cambridge Group for the History of Population and Social Structure and a former President of the British Academy. His previous publications include Population and History (1969), People, Cities and Wealth (1987), Continuity, Chance and Change (1988), Poverty, Progress, and Population (2004), and, with R. S. Schofield, The Population History of England 1541 1871 (1981).</b044>

</contributor>


<contributor>

<b035>A01</b035>

<b039>R S</b039>

<b040>Davies</b040>


<professionalaffiliation>

<b046>University of Cambridge</b046>

</professionalaffiliation>

</contributor>


<contributor>

<b035>A01</b035>

<b039>J E</b039>

<b040>Oeppen</b040>


<professionalaffiliation>

<b046>University of Cambridge</b046>

</professionalaffiliation>

</contributor>


<contributor>

<b035>A01</b035>

<b039>R S</b039>

<b040>Schofield</b040>


<professionalaffiliation>

<b046>University of Cambridge</b046>

</professionalaffiliation>

</contributor>

 

Ideally, I would like to have multiple columns in my table for each "contributor". Can anyone give me any advice on how to modify the stylesheet so that I can extract the other data?

15 minutes ago, zeddyblue said:

Ideally, I would like to have multiple columns in my table for each "contributor".

No, I don't think you would want that. It would be very poor structure to have. Just as an example: if you wanted to search for a product by contributor, you would have to enter the same search criteria into each and every one of the "contributor" fields.

Ideally, you would have a related Contributors table, and you would either import the XML data twice - once into Products and once into Contributors, each importing its own set of fields - or import first into a temp "flat" table (where each contributor would be a record that also includes all the parent product data), and from there into the two target tables.

The first option requires that each product in the XML has a unique and permanent ID that can be used to relate the two tables.
The second option assumes that each product has at least one contributor.

  • Author
  • Newbies

Thanks Comment, 

Having a separate table would also make it easier to handle the different number and type of contributors for each book, i.e., author, editor, illustrator, etc. I have been so fixated on exporting all the data I didn't even think about the best way to use the data.  I am new to relational databases so thanks for steering me in the right direction. 

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.