<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../../_utils/schema/yaps.rnc" type="application/relax-ng-compact-syntax"?>
<?xml-model href="../../../_utils/schema/yaps.isosch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<?xml-stylesheet type="text/xsl" href="yaps2slidy1.xslt"?>
<!-- $Id: djb_xslt-paradigm.xml 51709 2026-05-28 23:29:13Z syd $ -->
<TEI xmlns="http://www.wwp.northeastern.edu/ns/yaps">
  <teiHeader>
    <fileDesc>
      <titleStmt>
        <title>The XSLT Paradigm</title>
        <author>David J. Birnbaum, Martin Holmes</author>
      </titleStmt>
      <editionStmt>
        <edition>Introduction to XSLT for Digital Humanities, DHSI, 04-08 June 2012</edition>
      </editionStmt>
      <publicationStmt>
        <distributor>Women Writers Project (via website)</distributor>
        <address>
          <addrLine>url:mailto:wwp@northeastern.edu</addrLine>
        </address>
        <date when="2012-06-04"/>
        <availability status="restricted">
          <p>Copyright 2011 David J. Birnbaum, Martin Holmes and the Women Writers Project</p>
          <p>This TEI-encoded XML file is available under the terms of the <ref target="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons
          Attribution-ShareAlike 3.0 (Unported)</ref> license.</p>
        </availability>
        <pubPlace>Providence, RI USA</pubPlace>
      </publicationStmt>
      <sourceDesc>
        <p>How XSLT thinks of XML</p>
      </sourceDesc>
    </fileDesc>
  </teiHeader>
    <text>
        <presentation>
            <section>
                <head>Nuts and bolts of an XSLT stylesheet</head>
                <slide>
                    <list>
                        <item><gi>xsl:stylesheet</gi></item>
                        <item><gi>xsl:output</gi></item>
                        <item><gi>xsl:template</gi></item>
                        <item><gi>xsl:apply-templates</gi></item>
                        <item>Creating the XHTML output framework</item>
                    </list>
                </slide>
            </section>
            <section>
                <head><gi>xsl:stylesheet</gi></head>
                <slide>
                    <eg><![CDATA[<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.w3.org/1999/xhtml"
    xpath-default-namespace="http://www.tei-c.org/ns/1.0"
    version="2.0">]]></eg>
                    <p>Wrapper element that contains the entire stylesheet</p>
                    <eg><![CDATA[xmlns:xsl="http://www.w3.org/1999/XSL/Transform"]]></eg>
                    <p>Always required</p>
                    <eg><![CDATA[xmlns="http://www.w3.org/1999/xhtml"]]></eg>
                    <p>Required if the output is XHTML</p>
                    <eg><![CDATA[xpath-default-namespace="http://www.tei-c.org/ns/1.0"]]></eg>
                    <list>
                        <item>Optional, but useful when transforming TEI input documents</item>
                        <item>Tells the stylesheet to assume input is in the TEI namespace unless
                            specified otherwise</item>
                    </list>
                    <eg><![CDATA[version="2.0"]]></eg>
                    <p>Required</p>

                </slide>
            </section>
            <section>
                <head><gi>xsl:output</gi></head>
                <slide>
                    <eg><![CDATA[<xsl:output method="xhtml" indent="yes"/>]]></eg>
                    <p>Empty element; describes output formatting</p>
                    <eg><![CDATA[method="xhtml"]]></eg>
                    <p>May be <code>xhtml</code>, <code>xml</code>, <code>text</code>,
                            <code>html</code> (use <code>xhtml</code> instead).</p>
                    <eg><![CDATA[indent="yes"]]></eg>
                    <p>Set to <code>yes</code> to wrap long lines and indent nested elements for ease in reading the output</p>
                </slide>
            </section>
            <section>
                <head><code>&lt;xsl:template match="XPath"&gt;</code></head>
                <slide>
                    <p>Contains instructions to be executed when the template fires</p>
                    <eg><![CDATA[<xsl:template match="div">]]></eg>
                    <p>The <code>match</code> attribute specifies an XPath to which the template
                        will be applied. This examples matches any <gi>div</gi> element.</p>
                    <eg><![CDATA[<xsl:template match="div">
    <p><xsl:apply-templates/></p>
</xsl:template>]]></eg>
                    <p>When you encounter a <gi>div</gi>, create a <gi>p</gi>. Then process the
                        contents of the <gi>div</gi>, putting any output of those template rules
                        inside the <gi>p</gi>.</p>
                </slide>
            </section>
            <section>
                <head><code>&lt;xsl:apply-templates select="XPath"/&gt;</code></head>
                <slide>
                    <list>
                        <item>Empty element.</item>
                        <item>The <code>select</code> attribute identifies the XPath of the nodes to
                            process at this point.</item>
                        <item>What <term>process</term> means is determined by the template rule for
                            the node selected.</item>
                    </list>
                    <eg><![CDATA[<xsl:apply-templates select="head"/>]]></eg>
                    <p>Process all of the <gi>head</gi> children of the context node.</p>
                    <eg><![CDATA[<xsl:apply-templates select="//body/div/div/sp[1]"/>]]></eg>
                    <p>Process the first speech (<gi>sp</gi>) of the first <gi>div</gi> that is
                        immediately under another <gi>div</gi> immediately under the <gi>body</gi>.
                        In <title>Hamlet</title>, this is the first speech of each scene.</p>
                    <eg><![CDATA[<xsl:apply-templates/>]]></eg>
                    <p>Process all of the children of the context node.</p>
                </slide>
            </section>
            <section>
                <head>Creating the XHTML output framework</head>
                <slide>
                    <egMarkup scheme="XSLT" type="valid">
                      <xsl:stylesheet
                          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                          xmlns="http://www.w3.org/1999/xhtml"
                          xpath-default-namespace="http://www.tei-c.org/ns/1.0"
                          version="2.0">
                        <xsl:output method="xhtml" indent="yes"/>
                        <xsl:template match="/">
                          <html>
                            <head>
                              <title>Title goes here</title>
                            </head>
                            <body>
                              <xsl:apply-templates/>
                            </body>
                          </html>
                        </xsl:template>
                        <!-- other template rules go here -->
                      </xsl:stylesheet>
                    </egMarkup>
                </slide>
            </section>
            
                <section>
                    <head>Stepping through the stylesheet (1)</head>
                    <slide>
                        <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_01.png" width="1000px" height="725px"/></figure>
                    </slide>
                </section>
            
            <section>
                <head>Stepping through the stylesheet (2)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_02.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (3)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_03.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (4)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_04.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (5)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_05.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (6)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_06.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (7)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_07.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (8)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_08.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (9)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_09.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (10)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_10.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (11)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_11.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (12)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_12.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (13)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_13.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (14)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_14.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (15)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_15.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            <section>
                <head>Stepping through the stylesheet (16)</head>
                <slide>
                    <figure><graphic url="../../../_utils/gfx/xhtml_xsl_stylesheet_16.png" width="1000px" height="725px"/></figure>
                </slide>
            </section>
            
            
        </presentation>
    </text>

</TEI>
