CIS 97YT Index > Lecture 7 > manual.xslt

Lecture 7
manual.xslt

XML file | XSLT file | HTML Result | HTML source

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="manual">
    <html>
    <head>
        <title><xsl:value-of select="attribute::id"/></title>
    </head>
    <body>
        <h2><xsl:value-of select="attribute::id"/></h2>
        <xsl:apply-templates/>
    </body>
    </html>
</xsl:template>

<xsl:template match="parts-list">
    <h3>Parts List</h3>
    <ul>
        <xsl:apply-templates/>
    </ul>
    <hr />
</xsl:template>

<xsl:template match="part">
    <li>Part <xsl:value-of select="attribute::label"/>
        (<xsl:value-of select="attribute::count"/>) -
        <xsl:apply-templates/>
    </li>
</xsl:template>

<xsl:template match="instructions">
    <h3>Instructions</h3>
    <ol>
        <xsl:apply-templates/>
    </ol>
</xsl:template>

<xsl:template match="step">
    <li><p>
       <xsl:apply-templates/>
     </p></li>
</xsl:template>

</xsl:stylesheet>