diff --git a/output/wordTypes.svg b/output/letters-to-svg.svg similarity index 100% rename from output/wordTypes.svg rename to output/letters-to-svg.svg diff --git a/xml/1819-01-10-MaryWebb.xml b/xml/1819-01-10-MaryWebb.xml index 723d4e9..1b26aef 100644 --- a/xml/1819-01-10-MaryWebb.xml +++ b/xml/1819-01-10-MaryWebb.xml @@ -1,10 +1,10 @@ - +schematypens="http://purl.oclc.org/dsdl/schematron"?>--> @@ -138,7 +138,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?>
- + Wilson Lisa @@ -174,7 +174,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Reading Central Library The principal archive of Mary Russell Mitford’s personal papers and related documents, holding approximately 1,000 manuscripts and a nearly comprehensive @@ -182,7 +182,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + LoRusso Natalie @@ -208,19 +208,19 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Americans People of the former British colonies recently become the United States in Mitford’s day, or more generally of North America. - + the Parfitt family the Parfitts - + Sir Francis Bacon Francis @@ -262,7 +262,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Morris Birkbeck Morris @@ -297,7 +297,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Thomas Browne Browne @@ -328,7 +328,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Alexander Brunton Alexander @@ -361,7 +361,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Mary Balfour Brunton Mary @@ -387,7 +387,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Edmund Burke Edmund @@ -420,7 +420,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + George Gordon, Lord Byron Byron @@ -452,7 +452,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Geoffrey Chaucer Geoffrey @@ -474,7 +474,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Mrs. Coffin Coffin @@ -489,7 +489,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Dickinson. Forename unidentified. Needs additional research. - + Samuel Taylor Coleridge Coleridge @@ -515,7 +515,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Mr. Crowther Crowther @@ -542,7 +542,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Library.

- + Dante Durante @@ -566,7 +566,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Jean de Joinville Jean @@ -585,7 +585,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Charles Dickinson Dickinson @@ -617,7 +617,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Mrs. Dickinson Catherine @@ -642,7 +642,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> corresp="#Lestrange_Letters">L'Estrange). - + Henry Bradshaw Fearon Henry @@ -666,7 +666,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + John Fletcher Fletcher @@ -690,7 +690,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Benjamin Franklin Benjamin @@ -726,7 +726,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Jean Froissart Jean @@ -749,7 +749,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + George Frederick Handel George @@ -770,7 +770,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + William Hazlitt Hazlitt @@ -813,7 +813,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Homer Melesigenes, Smyrna @@ -830,7 +830,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Leigh Hunt James @@ -851,7 +851,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + John Keats Keats @@ -880,7 +880,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Charles Lamb Lamb @@ -907,7 +907,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + John Liston Liston @@ -933,7 +933,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Mahomet Muhammad @@ -955,14 +955,14 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Miranda A greyhound owned by Mitford, described by her as blue all sprinkled with little white spots just like a starry night in her 13 February 1819 letter to Haydon. - + George Mitford George @@ -1014,7 +1014,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Mossy @@ -1023,7 +1023,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Mossy was a nickname for Moss Trooper. - + Mitford Mary @@ -1067,7 +1067,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Joseph Parfitt Joseph @@ -1078,7 +1078,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> in a letter to Mary Webb of January 10, 1819. More research needed. - + Sarah Parfitt Sarah @@ -1089,7 +1089,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> ref="#Webb_Mary_younger">Mary Webb of January 10, 1819. More research needed. - + Thomas Love Peacock Thomas @@ -1119,7 +1119,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Luigi Pulci Luigi @@ -1138,7 +1138,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Frances Rowden St. Quintin Rowden @@ -1178,7 +1178,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Madame Sévigné Marie @@ -1202,7 +1202,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Martha Seward Martha @@ -1211,7 +1211,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> An acquaintance of Mary Webb. Needs additional research. - + William Shakespeare Shakespeare @@ -1241,7 +1241,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Jeremy Taylor Jeremy @@ -1259,7 +1259,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Izaak Walton Izaak @@ -1281,7 +1281,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + George Washington George @@ -1310,7 +1310,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Eliza Webb Webb @@ -1339,7 +1339,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> >Roberts on November 27, 1953 . - + James Webb Webb @@ -1368,7 +1368,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> >Reading Central Library . - + John Webb John @@ -1380,7 +1380,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Likely Uncle John, uncle to Eliza and Mary Webb and younger brother to James Webb. - + Aunt Mary Webb Webb @@ -1405,7 +1405,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> . Relationship to other Webbs and birth and death dates unknown. More research needed. - + Mary Webb Webb @@ -1429,7 +1429,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> sister Eliza Webb Walter and her husband Henry Walter. Date of death unknown. More research needed. - + Kate Wheeler @@ -1442,13 +1442,13 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?>
- + Selim Mitford's ferocious white cat. - + Mr. Cypress Character in Peacock’s Nightmare Abbey. Identified by from the Greek philoskios (φιλοσκιος), a lover, or sectator, of shadows. - + Ferdinando Flosky @@ -1469,7 +1469,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> >Byron. Much of his misanthropical conversation is taken from the fourth canto of Childe Harold. - + Lord Grizzle @@ -1478,7 +1478,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Grizzle in a Haymarket production in 1810. - + Sancho Panza @@ -1487,7 +1487,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> ref="#Don_Quixote_char">Don Quixote in his service, from Don Quixote. - + Count Ugolino @@ -1496,7 +1496,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Bertram House, Berkshire, England Grazeley Berkshire @@ -1519,7 +1519,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Bertram House in April 1820, after financial reverses forced the family to sell the property. - + Theatre Royal Haymarket, Westminster, London, England Haymarket Theatre @@ -1544,7 +1544,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + London, England London England @@ -1556,7 +1556,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> From 1831 to 1925, the largest city in the world. - + New Mint, Little Tower Hill, London, England Tower Hill London @@ -1578,7 +1578,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> /> - + Portsmouth Blockhouses 50.800531 -1.109465900000032 @@ -1589,7 +1589,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Mills were the site of the world’s first mass production line and used all-metal machine tools. - + Reading, Berkshire, England Reading Berkshire @@ -1613,7 +1613,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> >Reading as the basis for Belford Regis; or Sketches of a Country Town. - + Sloane Street, Kensington, London, England Kensington London @@ -1626,7 +1626,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Square. Sloane Street takes its name from Sir Hans Sloane, who purchased the surrounding area in 1712. - + United States of America United States of America @@ -1636,49 +1636,51 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> - + Brobdingnag Fictional country populated by giantsin Swift’s novel Gulliver’s Travels. - + Barataria Fictional island of which Sancho Panza is awarded governorship in Don Quixote. - - + lily of the valley - lily-of-the-valley Convallaria - majalis - Lily of the valley (sometimes written lily-of-the-valley), a scented - woodland flowering plant native to the cool temperate Northern - Hemisphere in Asia and - Europe. Its scientific name is Convallaria majalis. It was - previously classified as in its own family (Convallariaceae), and before that was - believed to be part of the Lily family (Liliaceae). + Convallaria majalis + Asparagaceae + Scented woodland flowering plant native to the cool temperate + Northern Hemisphere. It was previously classified as in its own family (Convallariaceae), and before + that was believed to be part of the Lily family (Liliaceae). + + + + + + - - + wood sorrel - woodsorrel - wood-sorrel - Oxalis acetosella Oxalis - acetosella - Mitford likely refers to common wood sorrel, a member of the oxalis - family. It grows in mixed woodlands and bears a white flower. It is not related to sorrel proper (Rumex acetosa), although the two plants share an - acidic taste that may have led to the name. + Oxalis acetosella + Oxalidaceae + Mitford likely refers to common wood sorrel, a member of the oxalis family, native to the Northern Hemisphere, including the UK. It grows in mixed woodlands and is a low-growing plant with heart-shaped trilobal leaves that bears white flowers in April and May. The plant is not related to sorrel proper (Rumex acetosa), although the two plants share an acidic taste that may have led to the similar name. + + + + + + -
+
Where’er You Walk @@ -1704,14 +1706,14 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> J. M. Dent & Co. 1903 - + Childe Harold’s Pilgrimage Byron London John Murray Published in parts between 1812 and 1818. - + Discipline: A Novel Mary Brunton Edinburgh @@ -1719,7 +1721,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> 1814 First edition published anonymously. - + An Account of the European Settlements in America, in six parts Edmund Burke @@ -1728,7 +1730,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> R. and J. Dodsley - + Jonathan Swift Travels into Several Remote Nations of the World. In Four Parts. By Lemuel Gulliver, First a Surgeon, and then a Captain of Several Ships @@ -1739,7 +1741,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> London Motte - + Inferno Dante @@ -1750,7 +1752,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> %h3 Divine Comedy. Scholars believe the Divine Comedy was completed in 1420; it was first printed in . - + Lectures on the English Comic Writers, delivered at the Surry Institution William Hazlitt @@ -1763,7 +1765,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> 1819 Spelled Surry on title page. - + The Literary Pocket Book, or Companion for the Lover of Art and Nature Leigh Hunt @@ -1776,7 +1778,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> published of this almanac, published at the end of 1818 for 1819, which she received as a gift from her father. - + Melincourt Thomas Love Peacock T. Hookham, Jr. & co. @@ -1788,7 +1790,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Hall. - + Nightmare Abbey Thomas Love Peacock T. Hookham, Jr. @@ -1799,7 +1801,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> Hall. - + Rhododaphne: Or, The Thessalian Spell: A Poem Thomas Love Peacock T. Hookham, Jr. @@ -1807,7 +1809,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> London - + Self Control: A Novel Mary Brunton Edinburgh @@ -1815,7 +1817,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> 1811 First edition published anonymously. - + Sketches of America: a Narrative of a Journey of Five Thousand Miles Through the Eastern and Western States of America; Contained in Eight Reports Addressed to the Thirty-nine English Families by whom the Author was Deputed, in June 1817, to @@ -1860,7 +1862,7 @@ schematypens="http://purl.oclc.org/dsdl/schematron"?> <date>2008</date>: 117)</bibl> </cit>.</note> </bibl> - <bibl xmlns="http://www.tei-c.org/ns/1.0" xml:id="TomThumb_OHaraAdpt"> + <bibl xml:id="TomThumb_OHaraAdpt"> <author ref="#OHara_Kane">Kane O’Hara</author> <author ref="#Fielding_Henry">Henry Fielding</author> <bibl> diff --git a/xml/de_hsa-letter-856.xml b/xml/de_hsa-letter-856.xml index de19320..4ace32d 100644 --- a/xml/de_hsa-letter-856.xml +++ b/xml/de_hsa-letter-856.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<?xml-model href="https://gams.uni-graz.at/o:hsa.odd/RNG" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> -<?xml-model href="https://gams.uni-graz.at/o:hsa.odd/RNG" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?> +<!--<?xml-model href="https://gams.uni-graz.at/o:hsa.odd/RNG" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> +<?xml-model href="https://gams.uni-graz.at/o:hsa.odd/RNG" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>--> <TEI xmlns="http://www.tei-c.org/ns/1.0"> <teiHeader xml:lang="de"> <fileDesc> diff --git a/xml/ja_soseki-letter-ex3.xml b/xml/ja_soseki-letter-ex3.xml index 8e2a08e..689c4e0 100644 --- a/xml/ja_soseki-letter-ex3.xml +++ b/xml/ja_soseki-letter-ex3.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<?xml-model href="../tei_all_ja_430.rnc" type="application/relax-ng-compact-syntax"?> +<!--<?xml-model href="../tei_all_ja_430.rnc" type="application/relax-ng-compact-syntax"?>--> <TEI xmlns="http://www.tei-c.org/ns/1.0" xml:lang="ja"> <teiHeader> <fileDesc> diff --git a/xslt/1_TEItoHTML-template.xsl b/xslt/1_TEItoHTML-template.xsl index 4069012..a6ce6e3 100644 --- a/xslt/1_TEItoHTML-template.xsl +++ b/xslt/1_TEItoHTML-template.xsl @@ -6,6 +6,9 @@ xmlns="http://www.w3.org/1999/xhtml" version="3.0"> + <!-- 2024-08-23 We can begin by processing the Spanish linguistics letter (es_PS4000-TEIP5.xml), since we will + be working with this file throughout the workshop. --> + <xsl:output method="xhtml" html-version="5" indent="yes"/> <xsl:template match="/"> diff --git a/xslt/1a_letter-to-html.xsl b/xslt/1a_letter-to-html.xsl index 74b65b2..89b3538 100644 --- a/xslt/1a_letter-to-html.xsl +++ b/xslt/1a_letter-to-html.xsl @@ -10,7 +10,7 @@ Notice how the xpath-default-namespace and the xmlns attributes are defined in the XSLT root element! This is very important because they define the namespace of the input and the output files. - Run this on the es letter, and then one of the other letters (like 1819-01-10-MaryWebb.xml) to compare output. + Run this on the Spanish linguistics letter (es_PS4000-TEIP5.xml), and then one of the other letters (like 1819-01-10-MaryWebb.xml) to compare output. --> <xsl:output method="xhtml" html-version="5" indent="yes"/> diff --git a/xslt/1b_letter-to-html.xsl b/xslt/1b_letter-to-html.xsl index dbce5a0..c69c86f 100644 --- a/xslt/1b_letter-to-html.xsl +++ b/xslt/1b_letter-to-html.xsl @@ -6,10 +6,11 @@ xmlns="http://www.w3.org/1999/xhtml" version="3.0"> -<!-- 2022-07-24 ebb: This XSLT is designed to read a collection of XML files. It will - output a separate HTML file for each TEI XML letter in our letters folder. - You can run it in the XSLT debugger view by selecting any file at all as the XML source. - (We usually choose a file from within the collection.) +<!-- 2022-07-24 ebb: This XSLT is designed to read a collection of XML files. + It will output a separate HTML file for each TEI XML letter in our letters folder. + You can run it in the XSLT debugger view by selecting any xml-formatted file at all as the XML source. + + Stored output: output/html-letters --> <!-- ebb: Uncomment if processing only one file, and remove the xsl:for-each in the template match on `/`. diff --git a/xslt/5_TEI-to-pieChart-template.xsl b/xslt/3_TEI-to-pieChart-template.xsl similarity index 86% rename from xslt/5_TEI-to-pieChart-template.xsl rename to xslt/3_TEI-to-pieChart-template.xsl index 5b8e1f2..5a5ac0f 100644 --- a/xslt/5_TEI-to-pieChart-template.xsl +++ b/xslt/3_TEI-to-pieChart-template.xsl @@ -6,6 +6,12 @@ xmlns="http://www.w3.org/1999/xhtml" version="3.0"> + <!-- This XSLT is a starting point to output an HTML file with data formatted for a Google pie chart + Input: xml/es_PS4000-TEIP5.xml + + Stored Output: output/letter-to-pieChart.html + --> + <xsl:output method="xhtml" html-version="5" indent="yes"></xsl:output> <!-- MS: and now we can reuse the same example to create a pie chart using the javascript libary Google Charts: @@ -14,13 +20,13 @@ <xsl:variable name="spanishLetter" as="document-node()" select="doc('../xml/es_PS4000-TEIP5.xml')"/> - <xsl:variable name="wordCount" as="xs:integer" select="//w => count()"/> + <xsl:variable name="wordCount" as="xs:integer" select="$spanishLetter//w => count()"/> <xsl:variable name="countTypes" as="xs:integer"> - <xsl:value-of select="//w/@pos ! normalize-space() => distinct-values() => count()"/> + <xsl:value-of select="$spanishLetter//w/@pos ! normalize-space() => distinct-values() => count()"/> </xsl:variable> - <xsl:variable name="wordTypes" as="xs:string+" select="//w/@pos ! normalize-space() => distinct-values()"/> + <xsl:variable name="wordTypes" as="xs:string+" select="$spanishLetter//w/@pos ! normalize-space() => distinct-values()"/> diff --git a/xslt/5_TEI-to-pieChart.xsl b/xslt/3_TEI-to-pieChart.xsl similarity index 85% rename from xslt/5_TEI-to-pieChart.xsl rename to xslt/3_TEI-to-pieChart.xsl index e2ea908..71f7ffe 100644 --- a/xslt/5_TEI-to-pieChart.xsl +++ b/xslt/3_TEI-to-pieChart.xsl @@ -6,18 +6,24 @@ xmlns="http://www.w3.org/1999/xhtml" version="3.0"> + <!-- This XSLT outputs and HTML file with data formatted for a Google pie chart + Input: xml/es_PS4000-TEIP5.xml + + Output: output/letter-to-pieChart.html + --> + <xsl:output method="xhtml" html-version="5" indent="yes"></xsl:output> <xsl:variable name="spanishLetter" as="document-node()" select="doc('../xml/es_PS4000-TEIP5.xml')"/> - <xsl:variable name="wordCount" as="xs:integer" select="//w => count()"/> + <xsl:variable name="wordCount" as="xs:integer" select="$spanishLetter//w => count()"/> <xsl:variable name="countTypes" as="xs:integer"> - <xsl:value-of select="//w/@pos ! normalize-space() => distinct-values() => count()"/> + <xsl:value-of select="$spanishLetter//w/@pos ! normalize-space() => distinct-values() => count()"/> </xsl:variable> - <xsl:variable name="wordTypes" as="xs:string+" select="//w/@pos ! normalize-space() => distinct-values()"/> + <xsl:variable name="wordTypes" as="xs:string+" select="$spanishLetter//w/@pos ! normalize-space() => distinct-values()"/> diff --git a/xslt/3_TEI-to-SVG-template.xsl b/xslt/4_TEI-to-SVG-template.xsl similarity index 72% rename from xslt/3_TEI-to-SVG-template.xsl rename to xslt/4_TEI-to-SVG-template.xsl index e961c52..260528b 100644 --- a/xslt/3_TEI-to-SVG-template.xsl +++ b/xslt/4_TEI-to-SVG-template.xsl @@ -8,19 +8,23 @@ <xsl:output method="xml" indent="yes"/> - <!-- ebb: This will plot an SVG that reads the Spanish letter file and outputs a value for each + <!-- ebb: This will plot an SVG that reads the Spanish linguistics letter file and outputs a value for each part of speech and its percentage representation among all the words in the letter. + + Input: xml/es_PS4000-TEIP5.xml + + Stored Output: output/letters-to-svg.svg --> <xsl:variable name="spanishLetter" as="document-node()" select="doc('../xml/es_PS4000-TEIP5.xml')"/> - <xsl:variable name="wordCount" as="xs:integer" select="//w => count()"/> + <xsl:variable name="wordCount" as="xs:integer" select="$spanishLetter//w => count()"/> <xsl:variable name="countTypes" as="xs:integer"> - <xsl:value-of select="//w/@pos ! normalize-space() => distinct-values() => count()"/> + <xsl:value-of select="$spanishLetter//w/@pos ! normalize-space() => distinct-values() => count()"/> </xsl:variable> - <xsl:variable name="wordTypes" as="xs:string+" select="//w/@pos ! normalize-space() => distinct-values()"/> + <xsl:variable name="wordTypes" as="xs:string+" select="$spanishLetter//w/@pos ! normalize-space() => distinct-values()"/> <xsl:variable name="colors" as="xs:string+" select="'coral', 'pink', 'lavender'"/> @@ -36,10 +40,14 @@ <svg viewBox="0 0 600 500"> > <g transform="translate(50, 300)"> + <!-- X and Y axis lines: Line elements in SVG have a start point (x1,y1) and an endpoint (x2,y2) + Draw the X-axis line across the screen with x1 and x2 changing, and y1 and y2 at 0. + Draw the Y-axis line UP the screen (multiplying by the negative $ySpacer value), with x1 and x2 at 0. + --> <line id="x-Axis" x1="0" y1="0" x2="{$countTypes * $xSpacer}" y2="0" stroke="black" stroke-width="2"/> <line id="y-Axis" x1="0" y1="0" x2="0" y2="{50 * $ySpacer}" stroke="black" stroke-width="2"/> <text class="y-hash" x="-30" y="{50 * $ySpacer + 5}">50%</text> - + <!-- A text label in SVG has a single x and y coordinate. --> <text id="title" x="100" y="{50 * $ySpacer - 20}">Proportions of Word Types in the Spanish Letter</text> diff --git a/xslt/3_TEI-to-SVG.xsl b/xslt/4_TEI-to-SVG.xsl similarity index 67% rename from xslt/3_TEI-to-SVG.xsl rename to xslt/4_TEI-to-SVG.xsl index aea2b87..ea90f79 100644 --- a/xslt/3_TEI-to-SVG.xsl +++ b/xslt/4_TEI-to-SVG.xsl @@ -11,21 +11,21 @@ <!-- ebb: This will plot an SVG that reads the Spanish linguistics-markup letter file and outputs a value for each part of speech and its percentage representation among all the words in the letter. - Input: es_PS4000-TEIP5.xml + Input: xml/es_PS4000-TEIP5.xml - Output: + Stored Output: output/letters-to-svg.svg --> <xsl:variable name="spanishLetter" as="document-node()" select="doc('../xml/es_PS4000-TEIP5.xml')"/> - <xsl:variable name="wordCount" as="xs:integer" select="//w => count()"/> + <xsl:variable name="wordCount" as="xs:integer" select="$spanishLetter//w => count()"/> <xsl:variable name="countTypes" as="xs:integer"> - <xsl:value-of select="//w/@pos ! normalize-space() => distinct-values() => count()"/> + <xsl:value-of select="$spanishLetter//w/@pos ! normalize-space() => distinct-values() => count()"/> </xsl:variable> - <xsl:variable name="wordTypes" as="xs:string+" select="//w/@pos ! normalize-space() => distinct-values()"/> + <xsl:variable name="wordTypes" as="xs:string+" select="$spanishLetter//w/@pos ! normalize-space() => distinct-values()"/> <xsl:variable name="colors" as="xs:string+" select="'coral', 'pink', 'indianred'"/> @@ -68,7 +68,22 @@ <xsl:value-of select="$currentCount div $wordCount * 100"/> </xsl:variable> - <line x1="{position() * $xSpacer - $xSpacer div 2}" x2="{position() * $xSpacer - $xSpacer div 2}" y1="0" y2="{$percentage * $ySpacer}" stroke="{$colors[abs(3 - $currentPos mod 3)]}" stroke-width="{$xSpacer div 2}"/> + <line x1="{position() * $xSpacer - $xSpacer div 2}" x2="{position() * $xSpacer - $xSpacer div 2}" y1="0" y2="{$percentage * $ySpacer}" stroke="{$colors[3 - $currentPos mod 3]}" stroke-width="{$xSpacer div 2}"/> + <!-- ebb: To set the colors in @stroke, look at the $colors variable: We stored three color values in sequence, and each one has a position value of 1, 2, and 3. + So, we can do a little XPath arithmetic to determine which of the three color values is applied: + We are processing each member of the sequence of $wordTypes, and we have three colors. + We can divide the position value by 3 and output the remainder of the division, known as the modulo. This is found with the XPath mod operator. + But when a number is divisible by 3, we will have '0' as result, and that is not a position on our color list. + So, we subtract 3 - current position in the sequence of $wordTypes: + 3 - 1 mod 3 = 3 - 2 = 1 (coral) + 3 - 2 mod 3 = 3 - 1 = 2 (pink) + 3 - 3 mod 3 = 3 - 0 = 3 (indianred) + ... + 3 - 6 mod 3 = 3 - 0 = 3 (indianred) + 3 - 7 mod 3 = 3 - 1 = 2 (pink) + (etc.) + So we work with the remainders of a division by 3, and ensure that values are always 1, 2, or 3. + --> <text class="wordType" x="{position() * $xSpacer - $xSpacer div 2}" y="20"><xsl:value-of select="current()"/></text> diff --git a/xslt/4_TEI-to-text-template.xsl b/xslt/4_TEI-to-text-template.xsl deleted file mode 100644 index 850a5b4..0000000 --- a/xslt/4_TEI-to-text-template.xsl +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xpath-default-namespace="http://www.tei-c.org/ns/1.0" - exclude-result-prefixes="xs" - xmlns="http://www.w3.org/2000/svg" - version="3.0"> - - <xsl:output method="xml" indent="yes"/> - - <!-- MS: Elisa has done all the work to plot the part of speech encoding in SVG. Now we will se how we can easily reuse this XSLT to create a text file and - display the result in https://app.rawgraphs.io/. - --> - - <xsl:variable name="spanishLetter" as="document-node()" select="doc('../xml/es_PS4000-TEIP5.xml')"/> - - <xsl:variable name="wordCount" as="xs:integer" select="//w => count()"/> - - <xsl:variable name="countTypes" as="xs:integer"> - <xsl:value-of select="//w/@pos ! normalize-space() => distinct-values() => count()"/> - </xsl:variable> - - <xsl:variable name="wordTypes" as="xs:string+" select="//w/@pos ! normalize-space() => distinct-values()"/> - - <xsl:variable name="colors" as="xs:string+" select="'coral', 'pink', 'indianred'"/> - - <!--ebb: We'll plot percentages for each word type, so max Y value would be less than 100 --> - <xsl:variable name="xSpacer" as="xs:integer" select="50"/> - <xsl:variable name="ySpacer" as="xs:integer" select="-5"/> - <!-- Y values go down the screen as they increase. So we relocate 0,0 down the screen and - plot backwards into negative space to make bars go *up*. This works best with literal calculations. - Just put a negative sign on an y-spacing variable to handle the drawing upwards. - --> - - <xsl:template match="/"> - <svg viewBox="0 0 600 500"> > - - <g transform="translate(50, 300)"> - <line id="x-Axis" x1="0" y1="0" x2="{$countTypes * $xSpacer}" y2="0" stroke="black" stroke-width="2"/> - <line id="y-Axis" x1="0" y1="0" x2="0" y2="{25 * $ySpacer}" stroke="black" stroke-width="2"/> - <text class="y-hash" x="-30" y="{25 * $ySpacer + 5}">25%</text> - - <text id="title" x="100" y="{25 * $ySpacer - 20}">Proportions of Word Types in the Spanish Letter</text> - - - <xsl:comment><!--ebb: A comment "scratchpad" for surveying variable values. --> - Wordcount: <xsl:value-of select="$wordCount"/> - Types of words: <xsl:value-of select="$countTypes"/> - Word types: <xsl:value-of select="string-join($wordTypes, ', ')"/> - </xsl:comment> - - <g class="wordTypeData"> - <!-- For each word type, return a percentage based on its count divided by the total word count * 100.--> - <xsl:for-each select="$wordTypes"> - <xsl:sort select="$spanishLetter//w[@pos ! normalize-space() = current()] => count()"/> - - <xsl:variable name="currentPos" as="xs:integer" select="position()"/> - <xsl:variable name="currentCount" as="xs:integer"> - <xsl:value-of select="$spanishLetter//w[@pos ! normalize-space() = current()] => count()"/> - </xsl:variable> - - <xsl:variable name="percentage" as="xs:double"> - <xsl:value-of select="$currentCount div $wordCount * 100"/> - </xsl:variable> - - <line x1="{position() * $xSpacer - $xSpacer div 2}" x2="{position() * $xSpacer - $xSpacer div 2}" y1="0" y2="{$percentage * $ySpacer}" stroke="{$colors[abs(3 - $currentPos mod 3)]}" stroke-width="{$xSpacer div 2}"/> - - <text class="wordType" x="{position() * $xSpacer - $xSpacer div 2}" y="20"><xsl:value-of select="current()"/></text> - - <text class="percentLabel" x="{position() * $xSpacer - $xSpacer div 1.5}" y="{$percentage * $ySpacer -15}"><xsl:value-of select="$percentage ! round(., 2)"/>%</text> - - </xsl:for-each> - </g> - </g> - </svg> - </xsl:template> - -</xsl:stylesheet> \ No newline at end of file diff --git a/xslt/4_TEI-to-text.xsl b/xslt/4_TEI-to-text.xsl deleted file mode 100644 index 7b1a7da..0000000 --- a/xslt/4_TEI-to-text.xsl +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xpath-default-namespace="http://www.tei-c.org/ns/1.0" - exclude-result-prefixes="xs" - xmlns="http://www.w3.org/2000/svg" - version="3.0"> - - <xsl:output method="text" indent="yes"/> - - - <xsl:variable name="spanishLetter" as="document-node()" select="doc('../xml/es_PS4000-TEIP5.xml')"/> - - <xsl:variable name="wordCount" as="xs:integer" select="//w => count()"/> - - <xsl:variable name="countTypes" as="xs:integer"> - <xsl:value-of select="//w/@pos ! normalize-space() => distinct-values() => count()"/> - </xsl:variable> - - <xsl:variable name="wordTypes" as="xs:string+" select="//w/@pos ! normalize-space() => distinct-values()"/> - - - - <xsl:template match="/"> - - - <xsl:text>wordType</xsl:text><xsl:text>,</xsl:text><xsl:text>percentLabel</xsl:text> - <xsl:text> </xsl:text> - - <!-- For each word type, return a percentage based on its count divided by the total word count * 100.--> - <xsl:for-each select="$wordTypes"> - <xsl:sort select="$spanishLetter//w[@pos ! normalize-space() = current()] => count()"/> - - <xsl:variable name="currentCount" as="xs:integer"> - <xsl:value-of select="$spanishLetter//w[@pos ! normalize-space() = current()] => count()"/> - </xsl:variable> - - <xsl:variable name="percentage" as="xs:double"> - <xsl:value-of select="$currentCount div $wordCount * 100"/> - </xsl:variable> - - <xsl:value-of select="current()"/><xsl:text>,</xsl:text><xsl:value-of select="$percentage ! round(., 2)"/> - <xsl:text> </xsl:text> - </xsl:for-each> - - </xsl:template> - -</xsl:stylesheet> \ No newline at end of file