Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

XSLT to TT

by artist (Parson)
on Dec 07, 2006 at 19:11 UTC ( #588435=perlquestion: print w/replies, xml ) Need Help??

artist has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I have XML files and XSLT files ( from another source) to make it HTML & PDF. I like to convert XSLT into Template Toolkit File. Is it possible? How I can accomplish?
Thanks,
--Artist

Replies are listed 'Best First'.
Re: XSLT to TT
by jfroebe (Parson) on Dec 07, 2006 at 20:35 UTC

    While I think it is technically possible, using the style sheet to create a TT file really isn't practical. You would be better off creating a TT and writing a script that would read the XML, applying it to the TT file. Using the XSLT sheet to create a TT file would be difficult to implement and prone to maintenance nightmares IMHO ;-)

    Is there a particular reason why you want to use XSLT to create a TT file?

    Jason L. Froebe

    Team Sybase member

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

      I didn't say that I want to use XSLT to create a TT file. I have existing XSL file and I like to convert it to a TT file. I like to work with TT rather than XSL file in the long term. So I am looking for some sort of help to make TT file from XSL file.
      --Artist

        Sorry. I misread your original post. Since XSLT can be rather complex, my recommendation would be to do it by hand.

        Don't rely on a script that performs XSLT -> TT as they are radically different. Creating a generic script that would take an arbitrary XSLT style sheet and produce a TT template file that produces the same arbitrary output, would be very involved. Creating a script for specific XSLT style sheets that produce very similar output may be worth it if you have dozens or hundreds of style sheets to convert to TT.

        Jason L. Froebe

        Team Sybase member

        No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

Re: XSLT to TT
by grep (Monsignor) on Dec 07, 2006 at 23:36 UTC
    I'm going to rephrase your question into what I think you're trying to ask.

    You are currently using XML and XSLT to create HTML and PDF versions of your XML file. You want to know if you can get rid of the XSLT process and just use Template Toolkit to turn your XML in PDF and HTML?

    For the HTML output, sure you can do that. It should be fairly simple.

    For the PDF output that'd be a little hard. TT Templates are more form-like, where PDF syntax is more of a language (IIRC similar to PS). But you could use one of the many utilities to convert the HTML to PDF. Though, that may not look the way you want.

    grep
    XP matters not. Look at me. Judge me by my XP, do you?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://588435]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-12-03 20:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?