Jesse Sheidlower <[EMAIL PROTECTED]> writes: > Is anyone out there using Template::Plugin::XSLT ?
Aye, Sir. On a regular basis to convert Docbook XML to HTML, and bare XHTML snippets to "Corporate Design" HTML. > [...] > I have a snippet of XML in a column "cit" in my database. If I > save it to a file and work from the commandline, > > $ xsltproc cit.xsl cit_sample.xml > > works fine. However, from within TT, following the docs for > T::P::XSLT, if I try: > > [% USE transform = XSLT(/path/to/cit.xsl) %] > [% FOREACH record = results # DBIC result object %] > <td>[% record.cit | $transform %]</td> > [% END %] > > I get no results, just a <td></td> pair in my output. (If I > remove the "| $transform", I do get the raw XML in my output.) > The only error I get in my log is "Use of uninitialized value > in concatenation (.) or string at [the line in the template]", > showing that $transform is undefined, though I get no error at > the USE statement--yet if I put a bogus path to the > stylesheet, or go to a deliberately invalid stylesheet, I _do_ > get an error. This is strange. I doubt that $transform is undefined. You can check that easily by including 'Filter is: [% transform%]' in your template, which should yield something like 'Filter is: Template::Plugin::XSLT=HASH(0xe24ef0)'. I recall that I've here and then struggled with empty output from the filter, but this has, in every case, been caused by invalid XML input. The plugin's error handling is crap: If you ask it to convert invalid XML, all you get is an empty string, and the notorious "Use of uninitialized value in concatenation (.) or string ..." However, I've usually succeded with detecting the errors with xsltproc. > Anyone have a suggestion for what's going wrong, or for an alternate > way of accomplishing the same thing? Maybe an encoding issue? XML, per default, expects UTF8, and creates UTf8. If you draw texts from a database, maybe the strings aren't properly recognized as UTF8 by some part of the tool chain? I had a similar issue with texts from a LDAP source which were UTF8, but how should Net::LDAP know? -- Good luck, haj _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
