public/xml/lecturenotesM.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="lecturenotesM.xsl"?>
<notes>
<note>
<subject>Databases and XML</subject>
<header>XML First</header>
<date>2012-04-01</date>
<tags>
<tag>xml</tag>
<tag>css</tag>
</tags>
<presenter>Niels</presenter>
<item>
<content>test first item content area</content>
<tags>
<tag>xml</tag>
<tag>hallo</tag>
</tags>
</item>
<item>
<content>
Model solutions to last weeks assignments.
The easy way to display xml is by adding a
stylesheet and making the xml files aware of that.
</content>
<tags>
<tag>xml</tag>
<tag>css</tag>
<tag>browser</tag>
<tag>solutions</tag>
</tags>
</item>
</note>
<note>
<subject>Android and XML</subject>
<header>XSLT</header>
<date>2012-11-01</date>
<tags>
<tag>xml</tag>
<tag>xsl</tag>
</tags>
<presenter>Niels</presenter>
<item>
<content>test first item content area</content>
<tags>
<tag>xml</tag>
<tag>hallo</tag>
</tags>
</item>
<item>
<content>
XSL as programmatically managed by JS.
</content>
<tags>
<tag>xml</tag>
<tag>xsl</tag>
<tag>browser</tag>
<tag>solutions</tag>
</tags>
</item>
</note>
<note>
<subject>Databases and XML</subject>
<header>XML From February</header>
<date>2012-02-01</date>
<tags>
<tag>xml</tag>
<tag>css</tag>
</tags>
<presenter>Niels</presenter>
<item>
<content>test first item content area</content>
<tags>
<tag>xml</tag>
<tag>hallo</tag>
</tags>
</item>
<item>
<content>
Model solutions to last weeks assignments.
The easy way to display xml is by adding a
stylesheet and making the xml files aware of that.
</content>
<tags>
<tag>xml</tag>
<tag>css</tag>
<tag>browser</tag>
<tag>solutions</tag>
</tags>
</item>
</note>
<note>
<subject>Android and XML</subject>
<header>Java</header>
<date>2012-01-21</date>
<tags>
<tag>xml</tag>
<tag>xsl</tag>
</tags>
<presenter>Niels</presenter>
<item>
<content>test first item content area</content>
<tags>
<tag>xml</tag>
<tag>hallo</tag>
</tags>
</item>
<item>
<content>
XSL as programmatically managed by JS.
</content>
<tags>
<tag>xml</tag>
<tag>xsl</tag>
<tag>browser</tag>
<tag>solutions</tag>
</tags>
</item>
</note>
</notes>public/xml/subjects.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="html"
encoding="UTF-8"
indent="yes" />
<xsl:template match="/notes">
<section>
<xsl:apply-templates select="note">
<xsl:sort select="subject"/>
</xsl:apply-templates>
</section>
</xsl:template>
<xsl:template match="/notes/note">
<xsl:variable name="sub"
select="subject[not(.=following::subject)]"/>
<xsl:for-each select="$sub">
<button class="buttsub">
<xsl:value-of select="."/>
</button>
<br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>public/xml/headers.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output
method="html"
encoding="UTF-8"
indent="yes" />
<xsl:param name="param1"></xsl:param>
<xsl:template match="/notes">
<h2>
<xsl:value-of select="$param1"/>
</h2>
<section>
<xsl:apply-templates select="note">
<xsl:sort select="date"/>
</xsl:apply-templates>
</section>
</xsl:template>
<xsl:template match="/notes/note">
<xsl:if test="subject = $param1">
<button class="butthead">
<xsl:value-of select="header"/>
</button>
<xsl:text> </xsl:text>
<xsl:value-of select="date"/>
<br/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>public/xml/content.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="param1">XSLT</xsl:param>
<xsl:output
method="html"
encoding="UTF-8"
indent="yes" />
<xsl:template match="/notes/note">
<xsl:if test="header = $param1">
<div id="maincontainer">
<xsl:apply-templates/>
</div>
</xsl:if>
</xsl:template>
<xsl:template match="note/header">
<h2 id="noteheader"><xsl:apply-templates/></h2>
</xsl:template>
<xsl:template match="note/date">
<h2 id="notedate"><xsl:apply-templates/></h2>
</xsl:template>
<xsl:template match="note/tags">
<p><em>Subject tags: </em>
<xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="note/presenter">
<h3>Lecturer: <xsl:apply-templates/></h3>
</xsl:template>
<xsl:template match="note/item">
<section>
<header class="item">
<h1>Item:</h1>
</header>
<xsl:apply-templates/>
</section>
</xsl:template>
<xsl:template match="note/item/content">
<p><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="note/item/tags">
<p><em>Item tags: </em>
<xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="note/item/tags/tag">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="note/subject">
<header><h1><xsl:apply-templates/></h1></header>
</xsl:template>
</xsl:stylesheet>