For this take-home test, you will be transforming and styling a student-coded XML file for a project on the Skyrim legends based on the video game.
Save asto download the file to your computer and open it in oXygen.
xsl:stylesheet
root element and xsl:output
line this way to output HTML 5 (as we have been doing for previous assignments):
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output method="xhtml" html-version="5" omit-xml-declaration="yes" include-content-type="no" indent="yes"/> </xsl:stylesheet>
Your tasks for this test are:
<source>
and the <body>
elements to transform into HTML. (5 points)<para>
elements to:
<p>
elements (2 points), @id
attribute to the HTML <p>
, and use an Attribute Value Template (AVT) to make its value look like this:
"skyrim-1"
, "skyrim-2"
, etc. Hints: Use the count()
function, and review Obdurodon’s tutorial on Attribute Value Templates and the homework exercises in which we used them for help with this. (3 points).
<event>
<item>
<char>
<soCalled>
<faction>
<place>
Write XSLT to process these elements wherever they may be, and output them as HTML elements: You can use some
of the basic HTML in-line elements, like <em>
for emphasis or
<strong>
for strong emphasis, but you’ll also want to use CSS
to set some elements to different colors or background colors or borders or fonts or
font sizes or font styles (e.g., italic) or font weights (e.g., bold) or text
decoration (e.g., underlining) or text transformation (e.g., convert to all upper
case) … well … anything else. Use <span>
elements using @class
attributes for styling. (10 points)
When you write a template rule for mixed content (elements floating in text) and you want to simply process all the contents without remixing them,
you can just use <xsl:apply-templates/>
without the @select
attribute. This simply means, process everything inside this node, and apply templates to whatever you
find.
<faction>
elements to the same
HTML @class
, please create separate template rules to
match on factions according to their attribute values. For example,
<xsl:template match="faction[@ref='daedra']">
is a normal XPath expression to match <faction>
elements only if they have a @ref
attribute with the value
daedra. (3 points)
@align
attribute) as evil,
good, or
neutral. You can write an Attribute Value Template (AVT) that will dereference the
@ref
attribute on, say, <faction
ref="daedra">assassins</faction>
, look up
whether this is an "evil", "good", or "neutral" faction, and set the
@class
value accordingly. Make all "good"
factions one color and all "evil" factions a different color, letting
XPath look up the moral alignment of a faction for you. Note:
This will require the XSLT current()
function, to
read a specific value from the source node at the time it is being
processed. Learn more about current()
here..css
file extension, and specify how you want to style your <span>
elements. (5 points)<link>
element in your output HTML (you
can remind yourself how to do that here in this section
of our Intro to CSS). Set that <link>
element in your XSLT so it is always output every time you update your
code. (2 points)<span>
and
@class
to style your HTML page.CSS stylingfor styling backgrounds, text, and fonts, as well as the link for borders under
CSS box model.
You should make sure you have completed the following before submitting your test:
<source>
and <body>
elements and their
contents into HTML.<span>
elements with the @class
attribute.<link>
element to associate the CSS file.
Set up that <link>
element in your XSLT so it is always output when you produce the HTML.Please upload your XSLT, HTML, and CSS files to Canvas.