Code For
XSLT Stylesheet"Hypertext_Fiction.xsl"
(Alan Liu's "Tracker"
demo)
// Called
by the XML document "falco_instance.xml"
to transform XML into HTML for Web;
// Uses <SPAN> tags to format for HTML the content found in "nodes"
in the XML document;
// Note the analogy between the XPATH language "select" statement
that locates nodes (e.g.
// "select="REGISTER/WORK" and the SQL "select" statement
<?xml version="1.0"?> <!-- File Name: Hypertext_Fiction.xsl --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <HTML> <HEAD> <TITLE>Hypertext Fiction Tracker</TITLE> </HEAD> <BODY> <SPAN STYLE="font-family:arial, Helvetica, sans-serif; font-size:14px"> <DIV align="center"> <FONT size="+4">Hypertext Fiction Tracker</FONT><BR/> <FONT size="+3">Conceptual Demo of XML Application</FONT><BR/> <FONT size="+2">(Alan Liu; last rev. Feb. 18, 2002)</FONT> </DIV><BR/> <xsl:for-each select="REGISTER/WORK"> <SPAN STYLE="font-size:130%; font-weight:900"> Title of Work: </SPAN> <SPAN STYLE="font-size:130%; font-weight:900; color:red"> "<xsl:value-of select="WORK_TITLE"/>" </SPAN><BR/> <SPAN STYLE="font-size:130%;font-weight:900"> Author: </SPAN> <SPAN STYLE="font-size:130%; font-weight:900; color:red"> <xsl:value-of select="AUTHOR"/> </SPAN><BR/> <SPAN STYLE="font-size:130%;font-weight:900"> Date of Publication: </SPAN> <SPAN STYLE="font-size:130%; color:red"> <xsl:value-of select="DATE"/> </SPAN><BR/> <SPAN STYLE="font-size:130%;font-weight:900"> Media Format: </SPAN> <SPAN STYLE="font-size:130%; color:red"> <xsl:value-of select="MEDIA"/> </SPAN><BR/> <SPAN STYLE="font-size:130%;font-weight:900"> URL: </SPAN> <SPAN STYLE="color:red"> <A><xsl:attribute name="href"> <xsl:value-of select="WORK_URL"/> </xsl:attribute> <xsl:value-of select="WORK_URL"/> </A><BR/> </SPAN><BR/><BR/><HR/> <SPAN STYLE="font-size:130%; font-weight:900; color:red"> Plot Strands: </SPAN><HR/><BR/> <xsl:for-each select="/REGISTER/WORK/PLOT/STRAND"> <SPAN STYLE="font-size:130%; font-weight:900; color:blue"> <xsl:value-of select="STRAND_TITLE"/> </SPAN><BR/><BR/> <xsl:for-each select="LEXIA"> <TABLE width="80%" border="1" align="center" bordercolordark="FFFFFF" bordercolor="#999999"> <TR> <TD width="15%"><SPAN STYLE="font-weight:800; color:blue">Lexia Title: </SPAN></TD> <TD><SPAN STYLE="font-weight:800; color:blue"> <xsl:value-of select="LEXIA_TITLE"/></SPAN></TD> </TR> <TR> <TD><SPAN STYLE="font-weight:800">Characters: </SPAN></TD> <TD><xsl:value-of select="CHARACTERS"/></TD> </TR> <TR> <TD><SPAN STYLE="font-weight:800">Mode: </SPAN></TD> <TD><xsl:value-of select="MODE"/></TD> </TR> <TR> <TD><SPAN STYLE="font-weight:800">Description or Keywords: </SPAN></TD> <TD><xsl:value-of select="KEYWORDS"/></TD> </TR> <TR> <TD><SPAN STYLE="font-weight:800">Lexia URL: </SPAN></TD> <TD><A> <xsl:attribute name="href"><xsl:value-of select="LEXIA_URL"/></xsl:attribute>
<xsl:attribute name="target">"2"</xsl:attribute> <xsl:value-of select="LEXIA_URL"/> </A> </TD> </TR> </TABLE><BR/><BR/> </xsl:for-each> <HR/> </xsl:for-each> </xsl:for-each> </SPAN> </BODY> </HTML> </xsl:template> </xsl:stylesheet>