Closed ghost closed 5 years ago
Great question! Internal links are something we make on pages that are going to be pretty long, if we want to hold a list of sorted, easy-to read links at the top of the page to "jump" down the page to their location in a long document below.
We need to see what this would look like in an HTML document to understand how to prepare such a thing. A document with a set of internal links might look and behave like this: https://dh.newtfire.org/dickinson-6.html
View the page source to see how those internal links are constructed, and what they're landing on.
If we pretended to make a page with internal links at the top listing a set of objects in a game, for example, our HTML code might look like this:
<!-- directory of objects at the top -->
<ul>
<li><a href="#object1">Interesting Game Object 1</a></li>
<li><a href="#object2">Interesting Game Object 2</a></li>
<li><a href="#object2">Interesting Game Object 2</a></li>
</ul>
<!-- longer internal descriptions deeper in the same HTML page -->
<section id="object1">
<h2>Interesting Game Object 1</h2>
<p>Long and interesting description of how this object is used and who uses it
and how it is used...</p>
</section>
<section id="object2">
<h2>Interesting Game Object 2</h2>
<p>Long and interesting description of how this object is used and who uses it
and how it is used...</p>
</section>
<section id="object3">
<h2>Interesting Game Object 3</h2>
<p>Long and interesting description of how this object is used and who uses it
and how it is used...</p>
</section>
How you write XSLT to produce this depends on your document encoding. You may need to work with Modal XSLT, if you want to process, say, a list of distinct-values of your game object element or attribute nodes to be output at the top of the HTML file. This would require having multiple template rules to process the same element node (your object elements) in two different ways. You'd need one template rule to match on <object>
elements and output list items in HTML for your table of contents in one "mode", and in an alternate mode, have another template rule to match on <object>
elements inline in the body of the document to wrap them in a <span class='object'>
maybe for highlighting them.
Read more about how to write Modal XSLT on Obdurodon's tutorial here: http://dh.obdurodon.org/modal-xslt.html
And give this a try on XSLT Ex 3, due Monday by the end of the day!
@koshinf @SparkTheDragon @JAG240 @James-f117 @achen298 @abdual1100 @NADGIT @frabbitry @alnopa9 @KSD32 @BMT45
How would you make links in XSLT that will take you to specific places in the HTML output?