media @ VU
media @ VU
[]
readme
course
preface
I
1
2
II
3
4
III
5
6
7
IV
8
9
10
V
11
12
afterthoughts
appendix
references
examples
resources
<?xml version="1.0"?>
recipe
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
For an example look at recipe
recipe
<xsl:template match="/Recipe">
<HTML>
<HEAD>
<TITLE>
<xsl:value-of select="Name"/>
</TITLE>
</HEAD>
body
<BODY>
<H3>
<xsl:value-of select="Name"/>
</H3>
<STRONG>
<xsl:value-of select="Description"/>
</STRONG>
<xsl:apply-templates/>
</BODY>
</HTML>
</xsl:template>
format ingredients
<!-- Format ingredients -->
<xsl:template match="Ingredients">
<H4>Ingredients</H4>
<TABLE BORDER="1">
<TR BGCOLOR="#308030"><TH>Qty</TH><TH>Units</TH><TH>Item</TH></TR>
<xsl:for-each select="Ingredient">
<TR>
quantity
<!-- handle empty Qty elements separately -->
<xsl:if test='Qty[not(.="")]' >
<TD><xsl:value-of select="Qty"/></TD>
</xsl:if>
<xsl:if test='Qty[.=""]' >
<TD BGCOLOR="#404040"> </TD>
</xsl:if>
units
<TD><xsl:value-of select="Qty/@unit"/></TD>
<TD><xsl:value-of select="Item"/>
<xsl:if test='Item/@optional="1"'>
<SPAN> -- <em><STRONG>optional</STRONG></em></SPAN>
</xsl:if>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
instructions
<!-- Format instructions -->
<xsl:template match="Instructions">
<H4>Instructions</H4>
<OL>
<xsl:apply-templates select="Step"/>
</OL>
</xsl:template>
<xsl:template match="Step">
<LI><xsl:value-of select="."/></LI>
</xsl:template>
etc
<!-- ignore all not matched -->
<xsl:template match="*" priority="-1"/>
</xsl:stylesheet>
[]
readme
course
preface
I
1
2
II
3
4
III
5
6
7
IV
8
9
10
V
11
12
afterthoughts
appendix
references
examples
resources
(C) A. Eliëns
9/8/2006
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.