SlideShare una empresa de Scribd logo
1 de 18
eXentensible Stylysheet
Language (XSL)
A BRIEF INTRODUCTION TO XSL 2.0 IN THE CTDA
XSL
XSL is eXtensible Stylesheet Language for XML documents. XSLT stands for XSL Transformations.
Are you familiar with CSS (or cascading stylesheets) for HTML?
XSL helps to display XML documents and includes:
• XSLT – language for transforming XML documents
• XPath – language for navigating XML documents
• XSL-FO – language for formatting XML documents
In this presentation, we will be looking at XSLT 2.0 and XPath to transform an XML document into another
XML document.
XPath
XML is a document and uses a language called XPath to navigate these documents. Xpath is
essentially to know for XSL.
XPath navigates “nodes” and there are 7:
◦ Elements
◦ Attributes
◦ Text
◦ Namespace
◦ Processing-instruction (<?name value?>
◦ Comment (<!-- -->)
◦ Document nodes
XPath and Nodes
The XML document is a tree of nodes.
In this example….
<bookstore> is the root element node
<author> is the element node
lang=“en” is the attribute node
Harry Potter or “en” are Atomic values or Items.
<book> is the child of <bookstore>
<title> is the sibling of <author>
What is <year>?
<book> and <bookstore> are the ancestors of <title>
What are the descendants of <bookstore>?
Selecting Nodes
Examples
Wildcards
Selecting 1+ Nodes
Start with an XML document
We’re working with a very small MODS export from Open Refine
Open-Refined-Farrel-xslx.txt
Before anything, rename this file with the extension “.xml”. Then, open this up in your xml editor
and remove all “null”. You might also have to take care of & or any html that you forgot to strip
in Open Refine such as <br>. You can use the Find and Replace Function in your text editor.
XML Document
What is the structure of this XML document? Can you find the root element? What are the
siblings, ancestors, descendants, etc.?
Is the XML document associated with a metadata standard? What is that standard and its
requirements?
What do you want to do?
Now that you understand the structure of your XML document, what do you want to do with it?
It is necessary to construct a sort of story about your XML document.
In the CTDA, we want to create individual MODS records that follow the CTDA MODS
implementation guidelines from the source XML document.
This is only one story. You can do other things with XSLT such as:
• I want to display my XML document in any browser.
• I want to count how many times the word “the” is used.
• Etc.
We want MODS XML documents
We have a source XML document. In our example, how many result MODS XML documents do
we need?
Does the source XML document and resulting MODS XML documents have the same structure?
What’s different?
What is our story?
Our tale begins with a small XML document. This xml file is not
associated with any namespace, and hence prefixes. It is not
associated with any metadata standard. This xml file has only 2
records.
The xml file has the following outline:
Root: metadata
Child of metadata: record
Children of record (grandchildren of metadata): Title, Creator,
Place, Topic, TopicPerson, Genre, Contributors, Datecreated,
FileName, Source, Collection, Rights
Story Continued
We want to create a folder (preferably) that
contains the individual MODS Records.
Each MODS record should preferably have the
file name of the image which is a condition of
the batch import. If not, you can generate a
random id with XSL.
Each MODS record must be well-formed and
valid according to the MODS schema and the
CTDA MODS Guidelines.
Story Ends
XSLT
XSLT must begin with the correct declaration.
<?xml version=“1.0” encoding=“UTF-8”?>
<xsl:stylesheet version=“2.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”>
•XSLT consists of one or more set of rules that are called templates.
•XSLT has a number of elements that help manipulate values of selected nodes or elements in
your source XML document.
<xsl:value-of> is used to extract the value of an XML element
<xsl:for-each> is used to select every XML element in a specific node-set
<xsl:choose> is used to express multiple conditional tests
<xsl:result-document> is used to write output to a file or directory.
Let’s create our 1st XSLT 2.0 Document
Questions?

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

10. XML in DBMS
10. XML in DBMS10. XML in DBMS
10. XML in DBMS
 
uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2uptu web technology unit 2 Xml2
uptu web technology unit 2 Xml2
 
Introduction to XML and Databases
Introduction to XML and DatabasesIntroduction to XML and Databases
Introduction to XML and Databases
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Xml schema
Xml schemaXml schema
Xml schema
 
01 xml document structure
01 xml document structure01 xml document structure
01 xml document structure
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 
XML.ppt
XML.pptXML.ppt
XML.ppt
 
Xml and xml processor
Xml and xml processorXml and xml processor
Xml and xml processor
 
HTML and XML Difference FAQs
HTML and XML Difference FAQsHTML and XML Difference FAQs
HTML and XML Difference FAQs
 
Xml
XmlXml
Xml
 
Xml schema
Xml schemaXml schema
Xml schema
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
XML-Extensible Markup Language
XML-Extensible Markup Language XML-Extensible Markup Language
XML-Extensible Markup Language
 
XML
XMLXML
XML
 
Xml basics for beginning
Xml basics for beginningXml basics for beginning
Xml basics for beginning
 
Dtd
DtdDtd
Dtd
 
Introduction to xml schema
Introduction to xml schemaIntroduction to xml schema
Introduction to xml schema
 
Basics of XML
Basics of XMLBasics of XML
Basics of XML
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 

Destacado

Collaborative Data Archiving and Access: Developing a Shared Repository Infra...
Collaborative Data Archiving and Access: Developing a Shared Repository Infra...Collaborative Data Archiving and Access: Developing a Shared Repository Infra...
Collaborative Data Archiving and Access: Developing a Shared Repository Infra...University of Connecticut Libraries
 
A Cloud of Your Own: Preservation & Access Services from the Connecticut Digi...
A Cloud of Your Own: Preservation & Access Services from the Connecticut Digi...A Cloud of Your Own: Preservation & Access Services from the Connecticut Digi...
A Cloud of Your Own: Preservation & Access Services from the Connecticut Digi...University of Connecticut Libraries
 
Seeing Connecticut Now and Then: Repository Services that Support Your Best M...
Seeing Connecticut Now and Then: Repository Services that Support Your Best M...Seeing Connecticut Now and Then: Repository Services that Support Your Best M...
Seeing Connecticut Now and Then: Repository Services that Support Your Best M...University of Connecticut Libraries
 
We Don't Make Your Preservation Program, We Make Your Preservation Program Be...
We Don't Make Your Preservation Program, We Make Your Preservation Program Be...We Don't Make Your Preservation Program, We Make Your Preservation Program Be...
We Don't Make Your Preservation Program, We Make Your Preservation Program Be...University of Connecticut Libraries
 

Destacado (20)

CTDA Overview September 2016
CTDA Overview September 2016CTDA Overview September 2016
CTDA Overview September 2016
 
How to Add Or Replace a Datastream
How to Add Or Replace  a DatastreamHow to Add Or Replace  a Datastream
How to Add Or Replace a Datastream
 
CTDA Brown Bag, Dec. 2016
CTDA Brown Bag, Dec. 2016CTDA Brown Bag, Dec. 2016
CTDA Brown Bag, Dec. 2016
 
CTDA MODS and Islandora XML Forms
CTDA MODS and Islandora XML FormsCTDA MODS and Islandora XML Forms
CTDA MODS and Islandora XML Forms
 
CTDA Metadata Application Profile
CTDA Metadata Application ProfileCTDA Metadata Application Profile
CTDA Metadata Application Profile
 
Collaborative Data Archiving and Access: Developing a Shared Repository Infra...
Collaborative Data Archiving and Access: Developing a Shared Repository Infra...Collaborative Data Archiving and Access: Developing a Shared Repository Infra...
Collaborative Data Archiving and Access: Developing a Shared Repository Infra...
 
A Cloud of Your Own: Preservation & Access Services from the Connecticut Digi...
A Cloud of Your Own: Preservation & Access Services from the Connecticut Digi...A Cloud of Your Own: Preservation & Access Services from the Connecticut Digi...
A Cloud of Your Own: Preservation & Access Services from the Connecticut Digi...
 
Seeing Connecticut Now and Then: Repository Services that Support Your Best M...
Seeing Connecticut Now and Then: Repository Services that Support Your Best M...Seeing Connecticut Now and Then: Repository Services that Support Your Best M...
Seeing Connecticut Now and Then: Repository Services that Support Your Best M...
 
CTDA Flyer 2016
CTDA Flyer 2016CTDA Flyer 2016
CTDA Flyer 2016
 
CTDA Brown Bag, Oct. 2016
CTDA Brown Bag, Oct. 2016CTDA Brown Bag, Oct. 2016
CTDA Brown Bag, Oct. 2016
 
CTDA Annual Meeting 2016
CTDA Annual Meeting 2016CTDA Annual Meeting 2016
CTDA Annual Meeting 2016
 
We Don't Make Your Preservation Program, We Make Your Preservation Program Be...
We Don't Make Your Preservation Program, We Make Your Preservation Program Be...We Don't Make Your Preservation Program, We Make Your Preservation Program Be...
We Don't Make Your Preservation Program, We Make Your Preservation Program Be...
 
How to Add A Compound Object
How to Add A Compound ObjectHow to Add A Compound Object
How to Add A Compound Object
 
CTDA End of Year Reports
CTDA End of Year ReportsCTDA End of Year Reports
CTDA End of Year Reports
 
How to Use the Manuscript Content Model
How to Use the Manuscript Content ModelHow to Use the Manuscript Content Model
How to Use the Manuscript Content Model
 
CTDA MODS Implementation Guidelines
CTDA MODS Implementation GuidelinesCTDA MODS Implementation Guidelines
CTDA MODS Implementation Guidelines
 
CTDA Brown Bag, Feb. 2017
CTDA Brown Bag, Feb. 2017CTDA Brown Bag, Feb. 2017
CTDA Brown Bag, Feb. 2017
 
CTDA: Brief Introduction
CTDA: Brief IntroductionCTDA: Brief Introduction
CTDA: Brief Introduction
 
Open refine to update and clean up your messy data
Open refine to update and clean up your messy dataOpen refine to update and clean up your messy data
Open refine to update and clean up your messy data
 
Web Services
Web ServicesWeb Services
Web Services
 

Similar a CTDA Workshop on XSL (20)

eXtensible Markup Language
eXtensible Markup LanguageeXtensible Markup Language
eXtensible Markup Language
 
Xml iet 2015
Xml iet 2015Xml iet 2015
Xml iet 2015
 
XML/XSLT
XML/XSLTXML/XSLT
XML/XSLT
 
unit_5_XML data integration database management
unit_5_XML data integration database managementunit_5_XML data integration database management
unit_5_XML data integration database management
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).pptDATA INTEGRATION (Gaining Access to Diverse Data).ppt
DATA INTEGRATION (Gaining Access to Diverse Data).ppt
 
Xslt
XsltXslt
Xslt
 
Xslt
XsltXslt
Xslt
 
Introduction to XSLT
Introduction to XSLTIntroduction to XSLT
Introduction to XSLT
 
Xsd
XsdXsd
Xsd
 
Xsd
XsdXsd
Xsd
 
Introduction of xml and xslt
Introduction of xml and xsltIntroduction of xml and xslt
Introduction of xml and xslt
 
advDBMS_XML.pptx
advDBMS_XML.pptxadvDBMS_XML.pptx
advDBMS_XML.pptx
 
XML1.pptx
XML1.pptxXML1.pptx
XML1.pptx
 
Xml intro1
Xml intro1Xml intro1
Xml intro1
 
Oracle soa xml faq
Oracle soa xml faqOracle soa xml faq
Oracle soa xml faq
 
Xml viva questions
Xml viva questionsXml viva questions
Xml viva questions
 
paper about xml
paper about xmlpaper about xml
paper about xml
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
XML Fundamentals
XML FundamentalsXML Fundamentals
XML Fundamentals
 

Último

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 

Último (20)

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

CTDA Workshop on XSL

  • 1. eXentensible Stylysheet Language (XSL) A BRIEF INTRODUCTION TO XSL 2.0 IN THE CTDA
  • 2. XSL XSL is eXtensible Stylesheet Language for XML documents. XSLT stands for XSL Transformations. Are you familiar with CSS (or cascading stylesheets) for HTML? XSL helps to display XML documents and includes: • XSLT – language for transforming XML documents • XPath – language for navigating XML documents • XSL-FO – language for formatting XML documents In this presentation, we will be looking at XSLT 2.0 and XPath to transform an XML document into another XML document.
  • 3. XPath XML is a document and uses a language called XPath to navigate these documents. Xpath is essentially to know for XSL. XPath navigates “nodes” and there are 7: ◦ Elements ◦ Attributes ◦ Text ◦ Namespace ◦ Processing-instruction (<?name value?> ◦ Comment (<!-- -->) ◦ Document nodes
  • 4. XPath and Nodes The XML document is a tree of nodes. In this example…. <bookstore> is the root element node <author> is the element node lang=“en” is the attribute node Harry Potter or “en” are Atomic values or Items. <book> is the child of <bookstore> <title> is the sibling of <author> What is <year>? <book> and <bookstore> are the ancestors of <title> What are the descendants of <bookstore>?
  • 9. Start with an XML document We’re working with a very small MODS export from Open Refine Open-Refined-Farrel-xslx.txt Before anything, rename this file with the extension “.xml”. Then, open this up in your xml editor and remove all “null”. You might also have to take care of & or any html that you forgot to strip in Open Refine such as <br>. You can use the Find and Replace Function in your text editor.
  • 10. XML Document What is the structure of this XML document? Can you find the root element? What are the siblings, ancestors, descendants, etc.? Is the XML document associated with a metadata standard? What is that standard and its requirements?
  • 11. What do you want to do? Now that you understand the structure of your XML document, what do you want to do with it? It is necessary to construct a sort of story about your XML document. In the CTDA, we want to create individual MODS records that follow the CTDA MODS implementation guidelines from the source XML document. This is only one story. You can do other things with XSLT such as: • I want to display my XML document in any browser. • I want to count how many times the word “the” is used. • Etc.
  • 12. We want MODS XML documents We have a source XML document. In our example, how many result MODS XML documents do we need? Does the source XML document and resulting MODS XML documents have the same structure? What’s different?
  • 13. What is our story? Our tale begins with a small XML document. This xml file is not associated with any namespace, and hence prefixes. It is not associated with any metadata standard. This xml file has only 2 records. The xml file has the following outline: Root: metadata Child of metadata: record Children of record (grandchildren of metadata): Title, Creator, Place, Topic, TopicPerson, Genre, Contributors, Datecreated, FileName, Source, Collection, Rights
  • 14. Story Continued We want to create a folder (preferably) that contains the individual MODS Records. Each MODS record should preferably have the file name of the image which is a condition of the batch import. If not, you can generate a random id with XSL. Each MODS record must be well-formed and valid according to the MODS schema and the CTDA MODS Guidelines.
  • 16. XSLT XSLT must begin with the correct declaration. <?xml version=“1.0” encoding=“UTF-8”?> <xsl:stylesheet version=“2.0” xmlns:xsl=“http://www.w3.org/1999/XSL/Transform”> •XSLT consists of one or more set of rules that are called templates. •XSLT has a number of elements that help manipulate values of selected nodes or elements in your source XML document. <xsl:value-of> is used to extract the value of an XML element <xsl:for-each> is used to select every XML element in a specific node-set <xsl:choose> is used to express multiple conditional tests <xsl:result-document> is used to write output to a file or directory.
  • 17. Let’s create our 1st XSLT 2.0 Document