I have two XML files and each contains 10 words and SVG file which will be the logo of the lexicon. Need some help to complete this.
- I want to transform this with XSL and create a lexicon page.
- There will be a title on top that states which languages it contains.
- Two parts with the words in alphabetical order, one in each direction (for example Swedish-English and English-Swedish).
- Visually, I want the keywords to be written in bold, while
the equivalents must be written in normal font. They should too
be of the same font size, 10 points, and be left aligned by one
words per line.
XML file 1: 10 Swedish words
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="wordlist_style.css"?>
<wordlist>
<language>Svenska</language>
<author>Karl Jonsson</author>
<words>
<word>natt</word>
<word>dag</word>
<word>vatten</word>
<word>bil</word>
<word>sol</word>
<word>himmel</word>
<word>stad</word>
<word>hus</word>
<word>katt</word>
<word>regn</word>
</words>
</wordlist>
XML file 2: 10 English words
<?xml version="1.0" encoding="UTF-8"?>
<wordlist>
<language>English</language>
<author>David Cahill</author>
<words>
<word>night</word>
<word>day</word>
<word>water</word>
<word>car</word>
<word>sun</word>
<word>sky</word>
<word>city</word>
<word>house</word>
<word>cat</word>
<word>rain</word>
</words>
</wordlist>
XML file that has paths to the two above XML files and a SVG file
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="lexicon.xsl"?>
<dictionary>
<dictionaryLink>wordlist_english.xml</dictionaryLink>
<dictionaryLink>wordlist_swedish.xml</dictionaryLink>
<svgLogoLink>logo.svg</svgLogoLink>
</dictionary>
XSL file that will transform the XML files to a lexicon
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variable name="dic1">
<xsl:value-of select="dictionaryLinkingData/dictionaryLink[1]"/>
</xsl:variable>
<xsl:variable name="dic2">
<xsl:value-of select="dictionaryLinkingData/dictionaryLink[2]"/>
</xsl:variable>
<xsl:variable name="logo">
<xsl:value-of select="dictionaryLinkingData/svgLogoLink"/>
</xsl:variable>
<xsl:template match="/dictionaries">
<html>
<body>
<xsl:value-of select="document($dic1)/wordlist/@xml:lang" />
<br/>
<div>
<img src="{lexicon/logo}"/>
<h1>Swedish - English</h1>
<div class="left">
<h2>Swedish - English</h2>
<ul>
<xsl:for-each select="lexicon/wordlist1">
<li><xsl:value-of select="word"/></li>
</xsl:for-each>
</ul>
</div>
<div class="right">
<h2>English - Swedish</h2>
<ul>
<xsl:for-each select="lexicon/wordlist2">
<li><xsl:value-of select="word"/></li>
</xsl:for-each>
</ul>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
CSS file to style the lexicon
.left {
float: left;
width: 50%;
font-weight: bold;
font-size: 10pt;
text-align: left;
}
.right {
float: right;
width: 50%;
font-size: 10pt;
text-align: left;
}
The above are the code blocks which I have worked on