Commits

Anonymous committed ede4e9a

Added the XSLT transformation support.

  • Participants
  • Parent commits 3f7b108
  • Tags releases/modules/XML-Grammar-ProductsSyndication/0.xx/0.01/0.01

Comments (0)

Files changed (13)

File perl/XML-Grammar-ProductsSyndication/MANIFEST

 META.yml # Will be created by "make dist"
 README
 t/00-load.t
+t/01-validate.t
+t/02-xslt-output.t
 t/boilerplate.t
+t/data/output-htmls/001-empty-cat.html
+t/data/output-htmls/002-nested-cat.html
+t/data/output-htmls/0030-with-one-product.html
+t/data/output-htmls/0031-with-products.html
+t/data/output-htmls/004-products-with-creators.html
+t/data/output-htmls/005-refs.html
+t/data/output-htmls/006-xhtml.html
+t/data/output-htmls/007-xhtml-2.html
+t/data/output-htmls/008-xhtml-3.html
+t/data/output-htmls/009-set.html
 t/data/valid-xmls/001-empty-cat.xml
 t/data/valid-xmls/002-nested-cat.xml
 t/data/valid-xmls/0030-with-one-product.xml

File perl/XML-Grammar-ProductsSyndication/lib/XML/Grammar/ProductsSyndication.pm

 
 use XML::Grammar::ProductsSyndication::ConfigData;
 use XML::LibXML;
+use XML::LibXSLT;
 
 use Moose;
 
 has '_filename' => (isa => 'Str', is => 'rw');
 has '_data_dir' => (isa => 'Str', is => 'rw');
+has '_xml_parser' => (isa => "XML::LibXML", is => 'rw');
+has '_stylesheet' => (isa => "XML::LibXSLT::StylesheetWrapper", is => 'rw');
 
 =head1 NAME
 
     return 0;
 }
 
+sub _get_xml_parser
+{
+    my $self = shift;
+
+    if (!defined($self->_xml_parser()))
+    {
+        $self->_xml_parser(XML::LibXML->new());
+        $self->_xml_parser()->validation(0);
+    }
+    return $self->_xml_parser();
+}
+
+sub _get_source_dom
+{
+    my $self = shift;
+
+    return $self->_get_xml_parser()->parse_file($self->_filename());
+}
+
 =head2 $processor->is_valid()
 
 Checks if the filename validates according to the DTD.
             ),
         );
 
-    my $p = XML::LibXML->new();
-    $p->validation(0);
-
-    my $dom = $p->parse_file($self->_filename());
-    
-    return $dom->validate($dtd);
+    return $self->_get_source_dom()->validate($dtd);
 }
 
+sub _get_stylesheet
+{
+    my $self = shift;
+
+    if (!defined($self->_stylesheet()))
+    {
+        my $xslt = XML::LibXSLT->new();
+
+        my $style_doc = $self->_get_xml_parser()->parse_file(
+                File::Spec->catfile(
+                    $self->_data_dir(), 
+                    "product-syndication.xslt"
+                ),
+            );
+
+        $self->_stylesheet($xslt->parse_stylesheet($style_doc));
+    }
+    return $self->_stylesheet();
+}
+
+=head2 $processor->transform_into_html({ 'output' => $output, })
+
+Transforms the output into HTML, and returns the results. If C<'output'> is 
+C<'xml'> returns the L<XML::LibXML> XML DOM. If C<'output'> is C<'string'>
+returns the XML as a monolithic string. Other C<'output'> formats are
+undefined.
+
+=cut
+
+sub transform_into_html
+{
+    my ($self, $args) = @_;
+
+    my $source_dom = $self->_get_source_dom();
+    my $stylesheet = $self->_get_stylesheet();
+
+    my $results = $stylesheet->transform($source_dom);
+
+    my $medium = $args->{output};
+
+    if ($medium eq "string")
+    {
+        return $stylesheet->output_string($results);
+    }
+    elsif ($medium eq "xml")
+    {
+        return $results;
+    }
+    else
+    {
+        die "Unknown medium";
+    }
+}
 =begin unused
 
 =head2 $processor->meta();

File perl/XML-Grammar-ProductsSyndication/t/02-xslt-output.t

+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::XML tests => 10;
+
+use File::Spec;
+use XML::Grammar::ProductsSyndication;
+
+sub get_files_list
+{
+    return
+    (
+    "001-empty-cat", # TEST
+    "002-nested-cat", # TEST
+    "0030-with-one-product", # TEST
+    "0031-with-products", # TEST
+    "004-products-with-creators", # TEST
+    "005-refs", # TEST
+    "006-xhtml", # TEST
+    "007-xhtml-2", # TEST
+    "008-xhtml-3", # TEST
+    "009-set", # TEST
+    );
+}
+
+my @xml_files = get_files_list();
+
+foreach my $xml_file (@xml_files)
+{
+    my $p = XML::Grammar::ProductsSyndication->new(
+        {
+            'source' =>
+            {
+                'file' => 
+                    File::Spec->catfile(
+                        "t", "data", "valid-xmls", "$xml_file.xml"
+                    ),
+            },
+            'data_dir' => File::Spec->catdir("blib", "extradata"),
+        }
+    );
+    my $got_xml = $p->transform_into_html({ 'output' => "string" });
+    is_xml ($got_xml, load_xml($xml_file),
+        "Testing for XML Equivalency of file '$xml_file'");
+}
+
+sub load_xml
+{
+    my $xml_file = shift;
+    my $path = 
+        File::Spec->catfile(
+            "t", "data", "output-htmls", "$xml_file.html"
+        );
+   
+    open my $in, "<", $path;
+    my $contents;
+    {
+        local $/;
+        $contents = <$in>;
+    }
+    close($in);
+    return $contents;
+}
+
+sub get_expected_fn
+{
+    my $file = shift;
+    if ($file =~ m{^(?:\./)?valid-xmls/(.*)\.xml$})
+    {
+        return "./outputs/$1.html";
+    }
+    else
+    {
+        die "Unknown filename";
+    }
+}

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/001-empty-cat.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/002-nested-cat.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+<div id="fiction_books" class="prod_cat">
+<h3>Fiction books</h3>
+</div>
+<div  id="computer_books" class="prod_cat">
+<h3>Computer books</h3>
+</div>
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/0030-with-one-product.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat"> 
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+<div id="fiction_books" class="prod_cat"> 
+<h3>Fiction books</h3>
+
+<div class="prod" id="little_women">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Little Women by Louisa May Alcott.
+</p>
+</div>
+</div>
+
+</div>
+<div id="computer_books" class="prod_cat"> 
+<h3>Computer books</h3>
+</div>
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/0031-with-products.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+<div id="fiction_books" class="prod_cat">
+<h3>Fiction books</h3>
+
+<div class="prod" id="little_women">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Little Women by Louisa May Alcott.
+</p>
+</div>
+</div>
+
+<div class="prod" id="around_the_world_in_80_days">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/"><img src="images/around_the_world_in_80_days.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/">Around the World in 80 Days</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Around the world by Jules Verne. About Fog and
+Passpartu.
+</p>
+</div>
+</div>
+</div>
+
+<div class="prod" id="not_a_book">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/"><img src="images/not_a_book.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/">This is a book that's not a book</a>
+</p>
+</div>
+<div class="desc">
+<p>
+I came. I saw. I conquered.
+</p>
+</div>
+</div>
+
+<div class="prod_cat" id="computer_books">
+<h3>Computer books</h3>
+</div>
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/004-products-with-creators.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+
+<div id="fiction_books" class="prod_cat">
+<div class="prod" id="little_women">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a><br />
+Louise May Alcott
+</p>
+</div>
+<div class="desc">
+<p>
+Little Women by Louisa May Alcott.
+</p>
+</div>
+</div>
+
+<div class="prod" id="around_the_world_in_80_days">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/"><img src="images/around_the_world_in_80_days.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/">Around the World in 80 Days</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Around the world by Jules Verne. About Fog and
+Passpartu.
+</p>
+</div>
+</div>
+
+</div>
+
+<div class="prod" id="not_a_book">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/"><img src="images/not_a_book.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/">This is a book that's not a book</a>
+</p>
+</div>
+<div class="desc">
+<p>
+I came. I saw. I conquered.
+</p>
+</div>
+</div>
+
+<div class="prod_cat" id="non_books">
+<h3>Non books</h3>
+
+<div class="prod" id="beatles_blue_album">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/"><img src="images/beatles_blue_album.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/">The Beatles - The Blue Album</a><br />
+The Beatles
+</p>
+</div>
+<div class="desc">
+<p>
+I became addicted to "Come Togethere".
+</p>
+</div>
+</div>
+</div>
+
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/005-refs.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+
+<div id="fiction_books" class="prod_cat">
+<div class="prod" id="little_women">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a><br />
+Louise May Alcott
+</p>
+</div>
+<div class="desc">
+<p>
+Little Women by Louisa May Alcott.
+</p>
+</div>
+</div>
+
+<div class="prod" id="around_the_world_in_80_days">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/"><img src="images/around_the_world_in_80_days.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/">Around the World in 80 Days</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Around the world by Jules Verne. About Fog and
+Passpartu.
+</p>
+</div>
+<div class="affil">
+<ul>
+<li>
+<a href="http://www.amazon.com/exec/obidos/ASIN/1577656806/ref=nosim/shlomifishhom-20">Amazon</a>
+</li>
+<li>
+<a href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&amp;EAN=9780140367119&amp;itm=1">Barnes &amp; Noble</a>
+</li>
+</ul>
+</div>
+</div>
+
+</div>
+
+<div class="prod" id="not_a_book">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/"><img src="images/not_a_book.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/">This is a book that's not a book</a>
+</p>
+</div>
+<div class="desc">
+<p>
+I came. I saw. I conquered.
+</p>
+</div>
+</div>
+
+<div class="prod_cat" id="non_books">
+<h3>Non books</h3>
+
+<div class="prod" id="beatles_blue_album">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/"><img src="images/beatles_blue_album.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/">The Beatles - The Blue Album</a><br />
+The Beatles
+</p>
+</div>
+<div class="desc">
+<p>
+I became addicted to "Come Togethere".
+</p>
+</div>
+</div>
+</div>
+
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/006-xhtml.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+
+<div id="fiction_books" class="prod_cat">
+<div class="prod" id="little_women">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a><br />
+Louise May Alcott
+</p>
+</div>
+<div class="desc">
+
+<p>
+Little Women by <a href="http://en.wikipedia.org/wiki/Louisa_May_Alcott" rel="author">Louisa May Alcott</a> is an 
+<b>early</b> and <strong>intriguing</strong>
+book.
+</p>
+
+</div>
+</div>
+
+<div class="prod" id="around_the_world_in_80_days">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/"><img src="images/around_the_world_in_80_days.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/">Around the World in 80 Days</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Around the world by Jules Verne. About Fog and
+Passpartu.
+</p>
+</div>
+<div class="affil">
+<ul>
+<li>
+<a href="http://www.amazon.com/exec/obidos/ASIN/1577656806/ref=nosim/shlomifishhom-20">Amazon</a>
+</li>
+<li>
+<a href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&amp;EAN=9780140367119&amp;itm=1">Barnes &amp; Noble</a>
+</li>
+</ul>
+</div>
+</div>
+
+</div>
+
+<div class="prod" id="not_a_book">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/"><img src="images/not_a_book.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/">This is a book that's not a book</a>
+</p>
+</div>
+<div class="desc">
+<p>
+I came. I saw. I conquered.
+</p>
+</div>
+</div>
+
+<div class="prod_cat" id="non_books">
+<h3>Non books</h3>
+
+<div class="prod" id="beatles_blue_album">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/"><img src="images/beatles_blue_album.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/">The Beatles - The Blue Album</a><br />
+The Beatles
+</p>
+</div>
+<div class="desc">
+<p>
+I became addicted to "Come Togethere".
+</p>
+</div>
+</div>
+</div>
+
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/007-xhtml-2.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+
+<div id="fiction_books" class="prod_cat">
+<div class="prod" id="little_women">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a><br />
+Louise May Alcott
+</p>
+</div>
+<div class="desc">
+
+<p>
+Little Women by <a href="http://en.wikipedia.org/wiki/Louisa_May_Alcott" rel="author">Louisa May Alcott</a> is an 
+<b>early</b> and <strong>intriguing</strong>
+book.
+</p>
+
+</div>
+</div>
+
+<div class="prod" id="around_the_world_in_80_days">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/"><img src="images/around_the_world_in_80_days.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/">Around the World in 80 Days</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Around the world by <a href="http://jules.tld/" 
+rel="myover">Jules 
+<strong>Verne</strong></a>. About <i>Fog</i> and
+Passpartu.
+</p>
+<p>
+<q>I wish I was taller, I wish I was a baller</q>
+</p>
+</div>
+<div class="affil">
+<ul>
+<li>
+<a href="http://www.amazon.com/exec/obidos/ASIN/1577656806/ref=nosim/shlomifishhom-20">Amazon</a>
+</li>
+<li>
+<a href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&amp;EAN=9780140367119&amp;itm=1">Barnes &amp; Noble</a>
+</li>
+</ul>
+</div>
+</div>
+
+</div>
+
+<div class="prod" id="not_a_book">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/"><img src="images/not_a_book.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/">This is a book that's not a book</a>
+</p>
+</div>
+<div class="desc">
+<p>
+I came. I saw. I conquered.
+</p>
+</div>
+</div>
+
+<div class="prod_cat" id="non_books">
+<h3>Non books</h3>
+
+<div class="prod" id="beatles_blue_album">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/"><img src="images/beatles_blue_album.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/">The Beatles - The Blue Album</a><br />
+The Beatles
+</p>
+</div>
+<div class="desc">
+<p>
+I became addicted to "Come Togethere".
+</p>
+</div>
+</div>
+</div>
+
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/008-xhtml-3.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+
+<div id="fiction_books" class="prod_cat">
+<div class="prod" id="little_women">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a><br />
+Louise May Alcott
+</p>
+</div>
+<div class="desc">
+
+<p>
+Little Women by <a href="http://en.wikipedia.org/wiki/Louisa_May_Alcott" rel="author">Louisa May Alcott</a> is an 
+<b>early</b> and <strong>intriguing</strong>
+book.
+</p>
+
+</div>
+</div>
+
+<div class="prod" id="around_the_world_in_80_days">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/"><img src="images/around_the_world_in_80_days.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/">Around the World in 80 Days</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Around the world by <a href="http://jules.tld/" 
+rel="myover">Jules 
+<strong>Verne</strong></a>. About <i>Fog</i> and
+Passpartu.
+</p>
+<p>
+<q>I wish I was taller, I wish I was a baller</q>
+</p>
+</div>
+<div class="affil">
+<ul>
+<li>
+<a href="http://www.amazon.com/exec/obidos/ASIN/1577656806/ref=nosim/shlomifishhom-20">Amazon</a>
+</li>
+<li>
+<a href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&amp;EAN=9780140367119&amp;itm=1">Barnes &amp; Noble</a>
+</li>
+</ul>
+</div>
+</div>
+
+</div>
+
+<div class="prod" id="not_a_book">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/"><img src="images/not_a_book.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/">This is a book that's not a book</a>
+</p>
+</div>
+<div class="desc">
+<p>
+I came. I saw. I conquered.
+</p>
+</div>
+</div>
+
+<div class="prod_cat" id="non_books">
+<h3>Non books</h3>
+
+<div class="prod" id="beatles_blue_album">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/"><img src="images/beatles_blue_album.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/56565656/ref=nosim/shlomifishhom-20/">The Beatles - The Blue Album</a><br />
+The Beatles
+</p>
+</div>
+<div class="desc">
+<p>
+I became addicted to "Come Together".
+</p>
+<ol>
+<li>
+It rules.
+</li>
+<li>
+It owns.
+</li>
+<li>
+In Soviet Russia, Come Together rules and
+owns <b>YOU</b>!
+</li>
+</ol>
+</div>
+</div>
+</div>
+
+</div>
+</body>
+</html>

File perl/XML-Grammar-ProductsSyndication/t/data/output-htmls/009-set.html

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE
+    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+<head>
+<title>Create a Great Personal Home Site</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+</head>
+<body>
+<div id="books" class="prod_cat">
+<h2>Books</h2>
+<p>
+These are my books.
+</p>
+
+<div id="fiction_books" class="prod_cat">
+<div class="prod" id="little_women">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/"><img src="images/little_women.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06903459409/ref=nosim/shlomifishhom-20/">Little Women</a><br />
+Louise May Alcott
+</p>
+</div>
+<div class="desc">
+
+<p>
+Little Women by <a href="http://en.wikipedia.org/wiki/Louisa_May_Alcott" rel="author">Louisa May Alcott</a> is an 
+<b>early</b> and <strong>intriguing</strong>
+book.
+</p>
+
+</div>
+</div>
+
+<div class="prod" id="around_the_world_in_80_days">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/"><img src="images/around_the_world_in_80_days.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/12340987/ref=nosim/shlomifishhom-20/">Around the World in 80 Days</a>
+</p>
+</div>
+<div class="desc">
+<p>
+Around the world by Jules Verne. About Fog and
+Passpartu.
+</p>
+</div>
+<div class="affil">
+<ul>
+<li>
+<a href="http://www.amazon.com/exec/obidos/ASIN/1577656806/ref=nosim/shlomifishhom-20">Amazon</a>
+</li>
+<li>
+<a href="http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&amp;EAN=9780140367119&amp;itm=1">Barnes &amp; Noble</a>
+</li>
+</ul>
+</div>
+</div>
+
+</div>
+
+<div class="prod" id="not_a_book">
+<div class="head">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/"><img src="images/not_a_book.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/06454545/ref=nosim/shlomifishhom-20/">This is a book that's not a book</a>
+</p>
+</div>
+<div class="desc">
+<p>
+I came. I saw. I conquered.
+</p>
+</div>
+</div>
+
+<div class="prod_cat" id="movies">
+<h3>Movies</h3>
+
+<div class="prod_set" id="indiana_jones">
+<p class="title">
+<strong>The Indiana Jones Trilogy</strong>
+</p>
+<div class="head">
+<ul>
+<li id="indiana_jones_1">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/111/ref=nosim/shlomifishhom-20/"><img src="images/indiana_jones_1.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/111/ref=nosim/shlomifishhom-20/">Raiders of the Lost Ark</a>
+</p>
+</li>
+
+<li id="indiana_jones_2">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/112/ref=nosim/shlomifishhom-20/"><img src="images/indiana_jones_2.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/112/ref=nosim/shlomifishhom-20/">Indiana Jones 2: The Temple of Doom</a>
+</p>
+</li>
+
+<li id="indiana_jones_3">
+<p class="prod_img">
+<a href="http://www.amazon.com/exec/obidos/ASIN/113/ref=nosim/shlomifishhom-20/"><img src="images/indiana_jones_3.jpg" alt="Preview" /></a>
+</p>
+<p class="prod_title">
+<a href="http://www.amazon.com/exec/obidos/ASIN/113/ref=nosim/shlomifishhom-20/">Indiana Jones and the Last Crusade</a>
+</p>
+</li>
+</ul>
+</div>
+<div class="desc">
+<p>
+Three great movies, high adventure, etc.
+</p>
+</div>
+</div>
+</div>
+
+</div>
+</body>
+</html>