Closed CodyKarch closed 9 years ago
I take back the "poem" part. I realized it what I was looking for.
I take it back, I'm very lost..
You're right, your problem is the //poem
part. There aren't any <poem>
elements, are there?
No, but I'm confused at what I'm looking for. What singles out ever individual poem?
Well everything we need rests in what element of the poem? We don't need every single poem because the XSLT is looking over the whole collection, so all of the poems are formatted the same way in the XMLs.
As long as we look at one of the poems, the XSLT will apply to all of the poems.
Well, all the information we need is in the body.. so I was thinking <xsl:apply-templates select="$dickinsonColl//body"/>
Exactly!
And now I need a template rule with that, right?
Yes. Have you done your @mode
yet?
<?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" xmlns:math="http://www.w3.org/2005/xpath-functions/math" exclude-result-prefixes="xs math" xmlns="http://www.w3.org/1999/xhtml" version="3.0">
<xsl:output method="xhtml" encoding="utf-8" doctype-system="about:legacy-compat"
omit-xml-declaration="yes"/>
<xsl:variable name="dickinsonColl" select="collection('Dickinson')"/>
<xsl:template match="/">
<html>
<body>
<h1 align="center">Emily Dickinson’s Fascicle 16</h1>
<h2>Table of Contents</h2>
<ul>
<xsl:apply-templates select="$dickinsonColl//body" mode="toc">
<xsl:sort order="descending"/>
</xsl:apply-templates>
</ul>
<hr></hr>
<div id="main">
<xsl:apply-templates select="$dickinsonColl//body"/>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="$dickinsonColl//body" mode="toc">
<li>
<a href="body">
<xsl:apply-templates select="//body//title"/>
<xsl:apply-templates select="//lg[1]/line[1]"/>
</a>
</li>
</xsl:template>
/xsl:stylesheet
This is what I have....
You're right as far as I can see so far!
The strange thing is that with all of that, NONE of it (except the H1 and H2) will show up when I test it
I actually just noticed that you don't need to link within the <li>
element. And don't you want to number the poems?
Oh.. Okay.. I'll check that out.. and it said that this line can't find a file (this does not exist) `
Is your XSLT saved in the same space as your collection of Dickinson poems?
ohhh... It was, but I moved it, that matters?
Yeah that matters.
Did it do anything since you moved it?
Nope. I placed my XSLT into the folder with my files, and tested it, and nothing changed.
It doesn't have to be in the folder. For example, if your Dickinson folder is sitting on your desktop, then your XSLT has to be sitting on your desktop as well.
I tried that... I placed my folder of Dickinson files on my desktop, and I placed my xslt on my desktop and tested it, but still the same...
I copy and pasted your XSLT into my oxygen and I'm coming up with something.
Did the whole thing work for you???
Yes, except the poem titles aren't in order. I think its because of your <xsl:sort>
element.
See... I can't get the entire thing... I literally can only get the H1 and H2 parts of my HTML
This is what it came up with on mine.
In that section, I get: `<!DOCTYPE html SYSTEM "about:legacy-compat">
Hmmm.... @RJP43 any suggestions??
I think there is a problem with my variable, but I can't pick what out...
Does assignment 5 even ask about sorting or using links? Make sure you are doing [Assignment 5]() and not assignment 6. In class I explained (in detail with what I wrote on the board) how the two parts of your variable were a name you choose for the collection and then the file path to the collection from where your xslt sits. I suggested to keep them in the same place so that you could use the same path I had shown in class.
Also, it looks to me like in your @match
(not the first one on the document node obviously but on your second one) you are asking for more than what is necessary. Consider this: your first two initial @select
s in your first match (inside of your html setup) are saying anything XSLT grabs will be from the body elements of the files from the collection; therefore, when you make a @match
from that point on you can just match on any and all <body>
elements and you don't need to repeat that you are going into the collection because XSLT already knows this from that first match's @select
. So you could just say match="body"
. Then in your @select
inside of that match on <body>
elements you can simplify and say go from here (using the dot .
) and go down to the title element (using the appropriate amount of slashes /
in consideration of where the <title>
elements sit in relation to <body>
) and output all of those. You would do similarly for the first lines.
Feel free to refer back to our in-class example
Also @CodyKarch it looks like you are selecting elements that don't appear in the source XML files ... I suggest you take a closer look at the elements that you are trying to grab and reconsider how you are going about completing the assignment. Here is a snippet of the Dickinson XML: `
<lg>
<l>Before I got my eye put out—</l>
<l>I liked as well to see</l>
<l>As other Creatures, that have Eyes—</l>
<l>And know no other way—</l>
</lg>`
versus the sonnets XML I used in-class:
`
Also thank you @nlottig94 for jumping on this issue ... I was engulfed in other homework and hadn't even noticed the GitHub pings until obviously much later.
@CodyKarch @RJP43 Good morning from Lyon, France! Cody, I just ran your XSLT, after saving it in a directory sitting immediately above the Dickinson collection of files. I'm getting output, just as @nlottig94 did. Since two of us are getting output, I think the problem really must be where you are positioning your XSLT in relation to the collection directory--and I'm trying to anticipate what could be going wrong for you: Could it be one of the following?
CodyXSLTEX5.xsl [Dickinson] your Dickinson folder sitting here
Since your XSLT really and truly is working for me all the way out here in France, I can only think the problem has to be where you're positioning your file and the Dickinson directory.
Hope this helps! Dr. B
Even further clarification: with the path we showed in class and how you have it in what you have sampled here fore us the XSLT sits beside not inside the folder that contains the collection files.
or if inside of a folder instead of on your desktop it might look similar to how we have things saved here on GitHub for the class example ---- found here
I'm having a very similar issue to Cody; I can't seem to get anything at all to output besides the html frame that I created. I'm getting this message:
FODC0002: The file or directory file:/Users/spada4/Documents/School/Pitt/Fall%202015/Digit%20Humanities/5.%20XSLT/Dickinson does not exist
That is in reference to this:
<xsl:apply-templates select="$dickinsonColl//body"/>
This is a screenshot of my file locations, just to show that:
I'm unsure how to continue if I can't check what I'm attempting to output.
Do you have your collection()
value as "Dickinson"? Like this? <xsl:variable name="dickinsonColl" select="collection('Dickinson')"/>
Yep:
<xsl:variable name="dickinsonColl" select="collection('Dickinson')"/>
I moved the Dickinson collection into the parent folder (where the error message seemed to be pointing), and I found this error:
SXXP0003: org.xml.sax.SAXParseException; systemId: file:/Users/spada4/Documents/School/Pitt/Fall%202015/Digit%20Humanities/5.%20XSLT/Dickinson/.DS_Store; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
Did you try just putting them both on your desktop?
Okay, just tried that. Still a fatal error, same one as my last comment.
Hmmm...do you have everything else finished for the assignment? I could compare it to mine before class and we could see what's up with it. You available before class?
I can meet up before class, but I don't have the assignment done, I've spent all my time just trying to figure out how to produce something at all from the Dickinson files.
Retry saving the Dickinson collection to your desktop by syncing and copying the folder from the GitHub desktop client
I can wait to post solutions and will keep the upload link active and we can have a look at it before class. My first class ends at 10:20 so I will get to the classroom ASAP
Thasks @nlottig94
I was wondering how I pick out the individual poems. I was trying to use this, but I know the poem part is wrong.
<xsl:apply-templates select="$dickinsonColl//poem"/> </body>
And I also was wondering how to test it, should I have every poem open as an XML and test it with my XSLT or what?