Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I've also added code that uses XML::XSLT , which surprising is VERY bad at least as I've used it (did I use it wrong? I couldn't get a pure XML DOM document to work with it...)

Heh, I discovered that there was an evil interaction between XML::Generator::DBI and XML::Handler::BuildDOM - I have sent patches to both Matt and Tim ;-}

I'll update this later with an example of how you might do this when I get a minute

Update: Matt has applied a fix to XML::Generator::DBI and this code now works as billed :

#!/usr/bin/perl -w use strict; use XML::XSLT; use XML::Generator::DBI; use XML::Handler::BuildDOM; use XML::DOM; use DBI; my $ya = XML::Handler::BuildDOM->new(); my $dbh = DBI->connect("dbi:Informix:tdcusers",'','',{ChopBlanks => 1} +); my $generator = XML::Generator::DBI->new( Handler => $ya, dbh => $dbh ); my $style =<<EOFOO; <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="" versi +on="1.0"> <xsl:output encoding = "iso-8859-1"/> <xsl:template match = "select"> <html> <head> <title> Test </title> </head> <body> <table> <xsl:for-each select="row"> <tr> <td> <xsl:value-of select="prefix" /> </td> <td> <xsl:value-of select="code" /> </td> <td> <xsl:value-of select="ctext" /> </td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> EOFOO my $stylesheet = XML::XSLT->new($style); my $sql = 'select * from text_codes'; my $dom = $generator->execute($sql); $stylesheet->transform(Source => $dom); $stylesheet->toString();

You will obviously want to use your own database and an appropriate stylesheet :)


In reply to Re: (Updates) Re: XSLT vs Templating, Part 2 by gellyfish
in thread XSLT vs Templating, Part 2 by Masem

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (10)
    As of 2021-04-16 12:30 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found