Skip to main content
ExLibris

Knowledge Assistant

BETA
  • Subscribe by RSS
  • Back
    Alma

     

    Ex Libris Knowledge Center
    1. Search site
      Go back to previous article
      1. Sign in
        • Sign in
        • Forgot password
    1. Home
    2. Alma
    3. Community Knowledge
    4. Generic XML Tips : Copy All to Construct 3 Creators (AND in Exists Condition)

    Generic XML Tips : Copy All to Construct 3 Creators (AND in Exists Condition)

    1. Last updated
    2. Save as PDF
    3. Share
      1. Share
      2. Tweet
      3. Share
    No headers
    Created By: Joan Kolarik
    Created on: 2/08/2020



    Please send suggestions and improvements to joan.kolarik@weizmann.ac.il


    Both these methods will create 3 creator fields if the source record contains 3 or more creators.

    A sample source record XML:

    <mods:name type="personal">
        <mods:role>
            <mods:roleTerm type="text" authority="pure/role">author</mods:roleTerm>
        </mods:role>
        <mods:namePart type="given">Yuri</mods:namePart>
        <mods:namePart type="family">Lima</mods:namePart>
        <mods:affiliation>
            Univ Fed Ceara, Universidade Federal do Ceara, Dept Matemat
        </mods:affiliation>
    </mods:name>


    Method 1

    These copy all examples take all child subfields, in the order that they occur, and create a field containing both subfields with a space between -- from the sample above, the result will be "Yuri Lima"

    rule "creator1"
    when
    exist "//*[local-name()='mods']/*[local-name()='name' and @type='personal'][1]/child::*[local-name()='namePart']"
    then
    copy all "//*[local-name()='mods']/*[local-name()='name' and @type='personal'][1]/child::*[local-name()='namePart']/text()"(", ") to "dc"."creator"
    end

    rule "creator2"
    when
    exist "//*[local-name()='mods']/*[local-name()='name' and @type='personal'][2]/child::*[local-name()='namePart']"
    then
    copy all "//*[local-name()='mods']/*[local-name()='name' and @type='personal'][2]/child::*[local-name()='namePart']/text()"(", ") to "dc"."creator"
    end

    rule "creator3"
    when
    exist "//*[local-name()='mods']/*[local-name()='name' and @type='personal'][3]/child::*[local-name()='namePart']"
    then
    set "et al" in "dc"."creator"
    end


    Method 2

    These copy examples take 2 specific child subfields (family and given) and create a field containing both with a comma and space between -- from the sample above, the result will be "Lima, Yuri"

    rule "creator1"
    when
    exist "//*[@type='personal'][1]/child::*[local-name()='namePart']"
    then
    copy "concat( //*[@type='personal'][1]/child::*[local-name()='namePart'][@type='family']/text(), ', ', //*[@type='personal'][1]/child::*[local-name()='namePart'][@type='given']/text())" to "dc"."creator"
    end

    rule "creator2"
    when
    exist "//*[@type='personal'][2]/child::*[local-name()='namePart']"
    then
    copy "concat( //*[@type='personal'][2]/child::*[local-name()='namePart'][@type='family']/text(), ', ', //*[@type='personal'][2]/child::*[local-name()='namePart'][@type='given']/text())" to "dc"."creator"
    end

    rule "creator3"
    when
    exist "//*[@type='personal'][3]/child::*[local-name()='namePart']"
    then
    copy "concat( //*[@type='personal'][3]/child::*[local-name()='namePart'][@type='family']/text(), ', ', //*[@type='personal'][3]/child::*[local-name()='namePart'][@type='given']/text())" to "dc"."creator"
    end


    Return to Contents Page for Generic XML Tips





    Report
    View article in the Exlibris Knowledge Center
    1. Back to top
      • Generic XML Tips : Contains Used in a Condition
      • Generic XML Tips : Element without Attribute + Local Discovery Field
    • Was this article helpful?

    Recommended articles

    1. Article type
      Topic
      Community Content Type
      How To
      Content Type
      Documentation
      Product
      Alma
    2. Tags
      This page has no tags.
    1. © Copyright 2025 Ex Libris Knowledge Center
    2. Powered by CXone Expert ®
    • Term of Use
    • Privacy Policy
    • Contact Us
    2025 Ex Libris. All rights reserved