How can I generate an XML using Perl and XSLT?
I want to generate an XML file using Perl and XSLT. Is it possible to achieve this by updating the XSLT dynamical开发者_如何转开发ly by uusing values from a hash?
Or is there any better solution for wirting a simple XML file using Perl?
The answer is "It depends" but generally "Simple" XML can be printed directly from Perl data structiures using XML::Simple module's XMLOut.
For more complicated use XML::Writer.
You can read more on handling of XML in Perl (including printing it) in Perl and XML O'Reilly book - for examples see Chapter 3 online (XML::Writer part): http://oreilly.com/catalog/perlxml/chapter/ch03.html
Also look at Perl-XML FAQ: http://perl-xml.sourceforge.net/faq/
XSLT is not for generating XML, it is merely for transforming XML. There's a comparison of the XML interfaces available to Perl on O'Reily's XML site
精彩评论