<!-- Pass along the <p>, <i>, <b>, <tt>, <ul>, <ol>, <li> tags -->
<xsl:template match="p|i|b|tt|ul|ol|li">
<xsl:copy>
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
<xsl:template match="a">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@href" />
</xsl:attribute>
<xsl:apply-templates />
</a>
</xsl:template>
<a href='<xsl:value-of select="@href"'> ... </a>
<xsl:template match="/">
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<!-- Article meta information:
title = Title of this article.
series = Name of the overall series.
series-url = URL for series index.
footer-text = Lead-in text for series URL at bottom
series-url-desc = Descriptive text for series URL <a> -->
<article
title="A Sample Article"
series="MYOML"
series-url="http://boodebr.org/series/myoml"
footer-text="Looking for the series index?"
series-url-desc="The main MYOML page"
>
<!-- The <article> tag -->
<xsl:template match="article">
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
<!-- Put article title in <title> element as well -->
<title><xsl:value-of select="@series" />: <xsl:value-of select="@title" /></title>
</head>
<body>
<div class="article-container">
<!-- Show a standard header -->
<div class="article-header">
<a class="hide">
<xsl:attribute name="href">
<xsl:value-of select="@series-url" />
</xsl:attribute>
<xsl:value-of select="@series" />
</a>: <xsl:value-of select="@title" />
</div>
<!-- Apply templates to article content -->
<xsl:apply-templates />
<!-- Show a standard footer -->
<div class="footer">
<xsl:value-of select="@footer-text" />
 
<a>
<xsl:attribute name="href">
<xsl:value-of select="@series-url" />
</xsl:attribute>
<xsl:value-of select="@series-url-desc" />
</a>
</div>
</div>
</body>
</html>
</xsl:template>
a:link {
text-decoration: underline;
color: #0000ff;
}
a:hover {
color: black;
background: #ffff00;
}
a:visited {
text-decoration: underline;
color: #000088;
}
a.hide:link {
text-decoration: none;
color: black;
}
a.hide:hover {
color: black;
background: #ffff00;
}
a.hide:visited {
text-decoration: none;
color: black;
}
<!-- <note> container -->
<xsl:template match="note">
<div class="note-container">
<div class="note-title">
<!-- use title= if user gave it, else use "NOTE" -->
<xsl:choose>
<xsl:when test="string-length(@title)">
<xsl:value-of select="@title" />
</xsl:when>
<xsl:otherwise>NOTE</xsl:otherwise>
</xsl:choose>
</div>
<div class="note-content">
<xsl:apply-templates />
</div>
</div>
</xsl:template>
<!-- <warn> container -->
<xsl:template match="warn">
<div class="warn-container">
<div class="warn-title">
<!-- use title= if user gave it, else use "WARNING" -->
<xsl:choose>
<xsl:when test="string-length(@title)">
<xsl:value-of select="@title" />
</xsl:when>
<xsl:otherwise>WARNING</xsl:otherwise>
</xsl:choose>
</div>
<div class="warn-content">
<xsl:apply-templates />
</div>
</div>
</xsl:template>
div.note-container {
margin-left: 1em;
margin-right: 1em;
margin-top: 1em;
margin-bottom: 1em
}
div.note-title {
font-size: 1em;
text-align: center;
font-weight: bold;
border: 1px solid #000000;
background: #59a2a3;
color: #ffffff;
padding-top: 3px;
padding-bottom: 3px;
}
div.note-content {
font-size: 1em;
border: 1px solid #888888;
background: #e3efef;
color: #000000;
padding-left: 1em;
padding-right: 1em;
padding-top: 0.8em;
padding-bottom: 0.8em;
}
div.warn-container {
margin-left: 1em;
margin-right: 1em;
margin-top: 1em;
margin-bottom: 1em
}
div.warn-title {
font-size: 1em;
text-align: center;
font-weight: bold;
border: 1px solid #000000;
background: #ff0000;
color: #ffffff;
padding-top: 3px;
padding-bottom: 3px;
}
div.warn-content {
font-size: 1em;
border: 1px solid #888888;
background: #eeeead;
color: #000000;
padding-left: 1em;
padding-right: 1em;
padding-top: 0.8em;
padding-bottom: 0.8em;
}
<article
title="A Sample Article"
series="Testing it Out"
series-url="http://boodebr.org/series/myoml"
footer-text="Looking for the series index?"
series-url-desc="The main MYOML page"
>
<section title="Section 3 - Other HTML tags">
<text>
Here is a link to <a href="http://www.python.org">python.org</a>
<p/>
Here is a list of fruits, unordered:
<ul>
<li>Apple</li>
<li>Orange</li>
<li>Banana</li>
</ul>
And as an ordered list:
<ol>
<li>Apple</li>
<li>Orange</li>
<li>Banana</li>
</ol>
Here is a note box:
<note title="Important Note">
Here is an important note about nothing. Here is some more text
to fill the box up and make it wordwrap.
<p/>
Here is a second paragraph in the box.
</note>
And now a warning box:
<warn>
Here is an important warning about nothing. Here is some more text
to fill the box up and make it wordwrap.
<p/>
Here is a second paragraph in the box.
</warn>
</text>
</section>