initial checkin of simple sorting example

git-svn-id: svn://10.0.0.236/trunk@65699 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
kvisco%ziplink.net
2000-04-12 10:57:19 +00:00
parent f6d355a99e
commit 4d06125b0d
3 changed files with 83 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>A simple sorting example</TITLE>
</HEAD>
<BODY>
<P ALIGN="CENTER">
<B>
<FONT SIZE="+2">Sorted Entries</FONT>
<HR SIZE="1">
</B>
</P>
<OL>
<LI>Dream Theatre</LI>
<LI>Gilbert, Paul</LI>
<LI>Royal Hunt</LI>
<LI>Satriani, Joe</LI>
</OL>
</BODY>
</HTML>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<?xml-stylesheet href="sort.xsl" type="text/xsl"?>
<!--
This is a sample XML document supplied with TransforMiiX
author: Keith Visco, kvisc@ziplink.net
-->
<sort>
<entry>Satriani, Joe</entry>
<entry>Dream Theatre</entry>
<entry>Royal Hunt</entry>
<entry>Gilbert, Paul</entry>
</sort>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- for read-ability use HTML output and enable indenting -->
<xsl:output method="html" indent="yes"/>
<!-- matches document node -->
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>A simple sorting example</TITLE>
</HEAD>
<BODY>
<P ALIGN="CENTER">
<B>
<FONT SIZE="+2">Sorted Entries</FONT>
<HR SIZE="1"/>
</B>
</P>
<!-- select and apply templates to remaining document -->
<xsl:apply-templates/>
</BODY>
</HTML>
</xsl:template>
<!-- matches root element -->
<xsl:template match="/*">
<OL>
<xsl:apply-templates>
<!-- sort using the value of the selected node -->
<xsl:sort select="."/>
</xsl:apply-templates>
</OL>
</xsl:template>
<!-- matches only entry elements -->
<xsl:template match="entry">
<LI><xsl:apply-templates/></LI>
</xsl:template>
</xsl:stylesheet>