# This is a patch for Pod-SAX-0.11 to update it to Pod-SAX-0.11-ak
# 
# To apply this patch:
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'applypatch' program with this patch file as input.
#
# If you do not have 'applypatch', it is part of the 'makepatch' package
# that you can fetch from the Comprehensive Perl Archive Network:
# http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz
# In the above URL, 'x' should be 2 or higher.
#
# To apply this patch without the use of 'applypatch':
# STEP 1: Chdir to the source directory.
# STEP 2: Run the 'patch' program with this file as input.
#
#### End of Preamble ####

#### Patch data follows ####
diff -u 'Pod-SAX-0.11/Makefile.PL' 'Pod-SAX-0.11-ak/Makefile.PL'
Index: ./Makefile.PL
--- ./Makefile.PL	Thu Jun 13 15:58:44 2002
+++ ./Makefile.PL	Mon Oct 28 18:13:15 2002
@@ -5,4 +5,28 @@
     'PREREQ_PM' => { XML::SAX => 0.10, XML::SAX::Writer => 0.39, Pod::Parser => 0 },
     'ABSTRACT_FROM' => 'lib/Pod/SAX.pm',
     'AUTHOR' => 'Matt Sergeant <matt@sergeant.org>',
+    'MAN3PODS' => {"lib/Pod/SAX.pm" => '$(INST_MAN3DIR)/Pod::SAX.$(MAN3EXT)',
+                   "pod2axpoint.xsl" => '$(INST_MAN3DIR)/pod2axpoint.xsl.$(MAN3EXT)',
+                  },
 );
+
+sub MY::postamble {
+  q{
+
+pdf: pod2axpoint.pdf
+	acroread pod2axpoint.pdf
+
+pod2axpoint.pdf: pod2axpoint.axp
+	axpoint pod2axpoint.axp pod2axpoint.pdf
+
+pod2axpoint.axp: pod2axpoint.xsl pod2axpoint.pod.xml
+	xsltproc pod2axpoint.xsl pod2axpoint.pod.xml > $@
+
+pod2axpoint.pod.xml: pod2axpoint.xsl
+	perl -e 'use XML::SAX::Writer;use Pod::SAX;' \\
+		-e 'my $$source = shift(@ARGV) or die;' \\
+		-e 'my $$output = shift (@ARGV) || \*STDOUT;' \\
+		-e 'my $$p = Pod::SAX->new({Handler => XML::SAX::Writer->new()});' \\
+		-e '$$p->parse_uri($$source);' pod2axpoint.xsl > $@
+};
+}
diff -u 'Pod-SAX-0.11/pod2axpoint.xsl' 'Pod-SAX-0.11-ak/pod2axpoint.xsl'
Index: ./pod2axpoint.xsl
--- ./pod2axpoint.xsl	Mon Jun 24 11:59:54 2002
+++ ./pod2axpoint.xsl	Mon Oct 28 18:16:08 2002
@@ -1,9 +1,145 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0">
 
+<!--
+
+=head1 pod2axpoint.xsl
+
+=head1 NAME
+
+pod2axpoint.xsl - Stylesheet to convert XMLified POD to AxPoint format
+
+=head1 SYNOPSIS
+
+Use Perl to generate XML from POD:
+
+  use XML::SAX::Writer;
+  use Pod::SAX;
+  my $source = shift(@ARGV) or die;
+  my $output = shift (@ARGV) || \*STDOUT;
+  my $p = Pod::SAX->new({Handler => XML::SAX::Writer->new()});
+  $p->parse_uri($source);
+
+No perl needed to transform the result to axpoint:
+
+  xsltproc pod2axpoint.xsl foo.pod.xml > foo.axp
+
+Finally transform that with the axpoint script to PDF:
+
+  axpoint foo.axp foo.pdf
+
+=head1 DESCRIPTION
+
+Pod is convenient to write markup.
+
+AxPoint is a powerful, prominent presentation
+markup.
+
+This XSLT stylesheet attempts to close the gap between POD and
+AxPoint.
+
+It is meant only for a subset of POD, not all of it. The idea is to
+let you write presentations in POD to convert to axpoint format, not
+to convert any POD document to a presentation. Actually, it fails on a
+broad variety of real world POD documents.
+
+It is also meant only for a subset of AxPoint. The C<transition>
+attribute for the C<title>, C<slide>, and C<point> element are not
+accessible through POD directives. Nor is the C<metadata> section or
+the C<image>, C<colour>, C<table>, C<rect>, C<circle>, C<ellipse>,
+C<line>, and C<text> elements. To make these options available, it is
+necessary to edit the stylesheet itself.
+
+=head1 CONFIGURATION
+
+You are expected to edit pod2axpoint.xsl to contain the speaker,
+organisation, etc., maybe a background image, or other metadata.
+
+=head1 DEMO
+
+A C<=head1> in the POD starts a new slide and sets the title. The very
+first C<=head1> sets the headline on the title page. Anything between
+the first and the second C<=head1> is ignored. Edit the stylesheet
+metadata section to fill the titlepage. Every paragraph is a point.
+There are other ways to generate points too:
+
+=head2 This is the content of a head2 tag
+
+=head3 This is the content of a head3 tag
+
+=over 4
+
+=item An item after an over 4
+
+And a paragraph within this item. As a paragraph is a point itself, we
+enter recursion here and the point gets a deeper level.
+
+=item Another item, the last one on this slide
+
+=back
+
+=head1 DEMO (cont'd)
+
+A paragraph with B<bold> text, I<italic> text, some C<$code+@code>, all
+of them produced with the POD inline tags. The next paragraph is
+indented POD, so that it must be rendered as source code:
+
+    sub foo { @{[[1,2]]} };
+    my ($one,$two) = @{foo()};
+    # my ($list) = foo(); my ($one,$two) = @$list;
+    print "1[$one] 2[$two]\n";
+
+And this is the third (and last) paragraph on this slide.
+
+=head1 DEMO (cont'd)
+
+=over 2
+
+=item Enjoy nesting (the item)
+
+Enjoy nesting (the paragraph)
+
+=over 4
+
+=item Enjoy nesting next level (the item)
+
+Enjoy nesting next level (the paragraph)
+
+=over 6
+
+=item Enjoy nesting 3rd (the item)
+
+Enjoy nesting 3rd (the paragraph)
+
+=back
+
+=back
+
+=back
+
+=head1 This Manpage as Slideshow
+
+In the root directory of the Pod::SAX distribution, run
+
+    make pdf
+
+and all conversions will happen, finally acroread will be called to
+display the slideshow.
+
+=cut
+
+-->
+
 <xsl:output method="xml" indent="yes"/>
 
-<xsl:key name="headings" match="para|head2|head3|verbatim|orderedlist|itemizedlist" use="generate-id(preceding::head1[1])"/>
+<xsl:key name="headings"
+ match="/pod/para|
+        /pod/head2|
+        /pod/head3|
+        /pod/verbatim|
+        /pod/orderedlist|
+        /pod/itemizedlist"
+ use="generate-id(preceding::head1[1])"/>
 
 <xsl:template match="/">
 <slideshow>
@@ -12,7 +148,7 @@
     <speaker>Ask Bjorn Hansen</speaker>
     <email>ask@perl.org</email>
   </metadata>
-    
+
   <xsl:apply-templates select="/pod/head1[position() > 1]"/>
 
 </slideshow>
@@ -22,19 +158,13 @@
   <xsl:variable name="this-id">
     <xsl:value-of select="generate-id(.)"/>
   </xsl:variable>
-  
+
     <slide>
       <title><xsl:apply-templates/></title>
       <xsl:apply-templates select="key('headings', $this-id)"/>
     </slide>
 </xsl:template>
 
-<xsl:template match="para">
-  <point>
-  <xsl:apply-templates/>
-  </point>
-</xsl:template>
-
 <xsl:template match="verbatim">
   <source-code>
   <xsl:apply-templates/>
@@ -53,18 +183,64 @@
   </b></point>
 </xsl:template>
 
-<xsl:template match="orderedlist">
-  <xsl:apply-templates/>
+<xsl:template match="itemizedlist|orderedlist">
+  <xsl:param name="level" select="1" />
+  <xsl:apply-templates>
+    <xsl:with-param name="level" select="$level" />
+  </xsl:apply-templates>
 </xsl:template>
 
-<xsl:template match="itemizedlist">
-  <xsl:apply-templates/>
+<xsl:template match="listitem">
+  <xsl:param name="level" select="1" />
+  <xsl:for-each select="node()">
+    <xsl:choose>
+      <xsl:when test="name(.) = 'para'
+                      or name(.) = 'listitem'
+                      or name(.) = 'itemizedlist'
+                      or name(.) = 'orderedlist'">
+        <xsl:if test="$level &lt; 3">
+          <xsl:apply-templates select=".">
+            <xsl:with-param name="level" select="$level + 1" />
+          </xsl:apply-templates>
+        </xsl:if>
+        <xsl:if test="$level &gt;= 3">
+          <xsl:apply-templates select=".">
+            <xsl:with-param name="level" select="$level" />
+          </xsl:apply-templates>
+        </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="c" select="normalize-space(.)" />
+        <xsl:if test="$c">
+          <point>
+            <xsl:attribute name="level">
+              <xsl:value-of select="$level" />
+            </xsl:attribute>
+            <xsl:value-of select="$c" />
+          </point>
+          <xsl:apply-templates />
+        </xsl:if>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:for-each>
 </xsl:template>
 
-<xsl:template match="listitem">
-  <point>
-  <xsl:apply-templates/>
-  </point>
+<xsl:template match="para">
+  <xsl:param name="level" select="1" />
+  <xsl:variable name='preceder' select="name(preceding-sibling::*[position() = 1])"/>
+  <xsl:choose>
+    <xsl:when test="$preceder = 'markup'">
+      <!-- ignore the paragraph in a =for section -->
+    </xsl:when>
+    <xsl:otherwise>
+      <point>
+        <xsl:attribute name="level">
+          <xsl:value-of select="$level" />
+        </xsl:attribute>
+        <xsl:apply-templates />
+      </point>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <xsl:template match="link">
@@ -89,4 +265,4 @@
   <xsl:apply-templates/>
 </xsl:template>
 
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
#### End of Patch data ####

#### ApplyPatch data follows ####
# Data version        : 1.0
# Date generated      : Mon Oct 28 18:18:00 2002
# Generated by        : makepatch 2.00_07*
# Recurse directories : Yes
# Excluded files      : (\A|/).*\~\Z
#                       (\A|/).*\.a\Z
#                       (\A|/).*\.bak\Z
#                       (\A|/).*\.BAK\Z
#                       (\A|/).*\.elc\Z
#                       (\A|/).*\.exe\Z
#                       (\A|/).*\.gz\Z
#                       (\A|/).*\.ln\Z
#                       (\A|/).*\.o\Z
#                       (\A|/).*\.obj\Z
#                       (\A|/).*\.olb\Z
#                       (\A|/).*\.old\Z
#                       (\A|/).*\.orig\Z
#                       (\A|/).*\.rej\Z
#                       (\A|/).*\.so\Z
#                       (\A|/).*\.Z\Z
#                       (\A|/)\.del\-.*\Z
#                       (\A|/)\.make\.state\Z
#                       (\A|/)\.nse_depinfo\Z
#                       (\A|/)core\Z
#                       (\A|/)tags\Z
#                       (\A|/)TAGS\Z
#                       (\A|/)RCS\Z
# p 'Makefile.PL' 288 1035825195 0100644
# p 'pod2axpoint.xsl' 1885 1035825368 0100644
#### End of ApplyPatch data ####

#### End of Patch kit [created: Mon Oct 28 18:18:00 2002] ####
#### Patch checksum: 330 9425 59380 ####
#### Checksum: 348 10114 50512 ####
