|
From: Grant M. <gr...@us...> - 2002-04-23 19:55:44
|
Update of /cvsroot/perl-xml/perl-xml-faq
In directory usw-pr-cvs1:/tmp/cvs-serv28907
Modified Files:
perl-xml-faq.xml
Log Message:
- added writeup for XML::PYX
- added section on XSLT (XML::XSLT, XML::Sablotron, XML::LibXSLT,
XML::Filter::XSLT
- fixed URL for Kip's article on validation using XPath
Index: perl-xml-faq.xml
===================================================================
RCS file: /cvsroot/perl-xml/perl-xml-faq/perl-xml-faq.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- perl-xml-faq.xml 19 Apr 2002 20:38:47 -0000 1.5
+++ perl-xml-faq.xml 23 Apr 2002 19:55:39 -0000 1.6
@@ -535,6 +535,47 @@
</answer>
</qandaentry>
+ <qandaentry id="xml_pyx">
+ <question>
+ <para><classname>XML::PYX</classname></para>
+ </question>
+ <answer>
+
+ <para>Matt Sergeant's <classname>XML::PYX</classname> comes with
+ some wrapper scripts for working with XML files using command line
+ pipelines. The PYX notation allows you to apply commands like
+ <command>grep</command> and <command>sed</command> to specific parts of
+ the XML document (eg: element names, attribute values, text content).
+ For example, this one-liner provides a report of how many times each
+ type of element is used in a document:</para>
+
+ <programlisting><![CDATA[
+pyx doc.xml | sed -n 's/^(//p' | sort | uniq -c
+ ]]></programlisting>
+
+ <para>This one creates a copy of an XML document with all
+ attributes stripped out:</para>
+
+ <programlisting><![CDATA[
+pyx doc1.xml | grep -v '^A' | pyxw > doc2.xml
+ ]]></programlisting>
+
+ <para>And this one spell checks the text content of a document skipping
+ over markup text such as element names and attributes:</para>
+
+ <programlisting><![CDATA[
+pyx talk.xml | sed -ne 's/^-//p' | ispell -l | sort -u
+ ]]></programlisting>
+
+ <para>Sean McGrath has written <ulink
+ url="http://www.xml.com/pub/a/2000/03/15/feature/index.html">an article
+ introducing PYX</ulink> on XML.com. PYX can be addictive - especially
+ if you're an awk or sed wizard, but if you find you're using Perl in
+ your pipelines you should consider switching to SAX.</para>
+
+ </answer>
+ </qandaentry>
+
<qandaentry id="xml_sax">
<question>
<para><classname>XML::SAX</classname></para>
@@ -751,6 +792,149 @@
</qandadiv>
+<qandadiv id="xslt"><title>XSLT Support</title>
+
+ <para>This section attempts to summarise the current state of Perl-related
+ XSLT solutions.</para>
+
+ <para>If you're looking for an introduction to <ulink
+ url="http://www.w3.org/TR/xslt">XSLT</ulink>, take a look at <ulink
+ url="http://www.ibiblio.org/xml/books/bible2/chapters/ch17.html">Chapter
+ 17</ulink> of the <ulink url="http://www.ibiblio.org/xml/books/bible2/">XML
+ Bible</ulink>.</para>
+
+ <qandaentry id="xml_xslt">
+ <question>
+ <para><classname>XML::XSLT</classname></para>
+ </question>
+ <answer>
+
+ <para>This module aims to implement XSLT in Perl, so the good news is
+ that so long as you have <classname>XML::Parser</classname> working you
+ won't need to compile anything to install this module. The bad news is
+ that it is not a complete implementation of the XSLT spec, it is still in
+ 'alpha' state and it's not clear whether it is under active development.
+ The <classname>XML::XSLT</classname> distribution includes a script you
+ can use from the command line like this:</para>
+
+ <programlisting><![CDATA[
+xslt-parser -s toc-links.xsl perl-xml-faq.xml > toc.html
+ ]]></programlisting>
+
+ <para>Egon Willighagen has written <ulink
+ url="http://www.linuxfocus.org/English/July2000/article156.shtml">An
+ Introduction to Perl's XML::XSLT module</ulink> at <ulink
+ url="http://www.linuxfocus.org/">linuxfocus.org</ulink>.</para>
+
+ <para>Some people have experienced difficulty installing the latest
+ version of this module - possibly since maintenance has been handled by
+ multiple people. At the time of writing, the latest version was
+ <filename>J/JS/JSTOWE/XML-XSLT-0.40.tar.gz</filename> although CPAN.pm
+ would only find
+ <filename>B/BR/BRONG/XML-XSLT-0.32.tar.gz</filename>.</para>
+
+ </answer>
+ </qandaentry>
+
+ <qandaentry id="xml_sablotron">
+ <question>
+ <para><classname>XML::Sablotron</classname></para>
+ </question>
+ <answer>
+
+ <para><ulink
+ url="http://www.gingerall.com/charlie/ga/xml/p_sab.xml">Sablotron</ulink>
+ is an XSLT processor written in C++ and developed as an open source
+ project by <ulink url="http://www.gingerall.com/">Ginger
+ Alliance</ulink>. Since the XSLT engine is written in C++ and uses
+ <classname>expat</classname> for XML parsing, it's pretty quick. The
+ XSLT implementation is almost complete and the product is under active
+ development. <ulink
+ url="http://www.gingerall.com/charlie/ga/xml/x_sabperl.xml"><classname>XML::Sablotron</classname></ulink>
+ is a Perl module which provides full access to the Sablotron API
+ (including a DOM with XPath support).</para>
+
+ </answer>
+ </qandaentry>
+
+ <qandaentry id="xml_libxslt">
+ <question>
+ <para><classname>XML::LibXSLT</classname></para>
+ </question>
+ <answer>
+
+ <para>Matt Sergeant's <classname>XML::LibXSLT</classname> is a Perl
+ wrapper for the GNOME project's <ulink
+ url="http://xmlsoft.org/XSLT/">libxslt</ulink> library. The XSLT
+ implementation is almost complete and the project is under active
+ development. The library is written in C and uses libxml2 for XML
+ parsing. Matt's testing found that it was about twice as fast as
+ Sablotron.</para>
+
+ </answer>
+ </qandaentry>
+
+ <qandaentry id="xml_filter_xslt">
+ <question>
+ <para><classname>XML::Filter::XSLT</classname></para>
+ </question>
+ <answer>
+
+ <para>Matt has also written <classname>XML::Filter::XSLT</classname>
+ which allows you to do XSLT transformations in a SAX pipeline. It
+ currently requires <classname>XML::LibXSLT</classname> but it is intended
+ to work with other XSLT processors in the future. In case you're
+ wondering, yes it does build a DOM of your complete document which it
+ transforms and then serialises back to SAX events. For this reason, it
+ might not be appropriate for multi-gigabyte documents.</para>
+
+ </answer>
+ </qandaentry>
+
+ <qandaentry id="axkit">
+ <question>
+ <para>AxKit</para>
+ </question>
+ <answer>
+
+ <para>If you're doing a lot of XML transformations (particularly for
+ web-based clients), you should take a long hard look at <ulink
+ url="http://www.axkit.org/">AxKit</ulink>. AxKit is a Perl-based
+ (actually mod_perl-based) XML Application server for <ulink
+ url="http://www.apache.org/httpd.html">Apache</ulink>. Here are some
+ of AxKit's key features:
+
+ <itemizedlist mark="bullet">
+
+ <listitem><para> Data can come from XML or any SAX data source (such as
+ a database query using <classname>XML::Generator::DBI</classname>)
+ </para></listitem>
+
+ <listitem><para>stylesheets can be selected
+ based on just about anything (file suffix, UserAgent, QueryString,
+ cookies, phase of the moon ...)</para></listitem>
+
+ <listitem><para>transformations can be specified
+ using a variety of languages including XSLT (LibXSLT or Sablotron),
+ XPathScript (a Perl-based transformation language) and XSP (a tag-based
+ language)</para></listitem>
+
+ <listitem><para>output formats can be anything you want (including HTML,
+ WAP, PDF etc)</para></listitem>
+
+ <listitem><para>caching of transformed documents can be handled
+ automatically or using your own custom scheme</para></listitem>
+
+ </itemizedlist>
+
+ </para>
+
+ </answer>
+ </qandaentry>
+
+</qandadiv>
+
+
<qandadiv id="encodings"><title>Encodings</title>
<qandaentry id="encodings_why">
@@ -1419,9 +1603,9 @@
<answer>
<para>Kip Hampton has written <ulink
- url="http://www.xml.com/pub/au/83">an article</ulink> describing how a
- combination of Perl and XPath can provide a quick, lightweight solution
- for validating documents.</para>
+ url="http://www.xml.com/pub/a/2000/11/08/perl/index.html">an
+ article</ulink> describing how a combination of Perl and XPath can
+ provide a quick, lightweight solution for validating documents.</para>
</answer>
</qandaentry>
|