开发者

How can I generate an XML using Perl and XSLT?

开发者 https://www.devze.com 2022-12-28 16:39 出处:网络
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?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号