Re: Read/Write file, break lines at 256 (or more) but NOT elements

Maurice Mengel <[email protected]> Mon, 21 Mar 2011 14:56:02 -0400
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
If Michael says that XSLT is the way to go then in all likelyhood he
is right. But maybe someone on this list could still suggest a perlish
way to solve that problem.

I find that Perl is good and fast with XSLT1 via LibXML  and
XML::LibXSLT and  that documentation of XML::LibXSLT is sufficient and
less obscure than the rest of LibXML to the LibXML novice. Installing
LibXSLT on Unix should also be easier than on other platforms.

I only have problems with perl and XSLT2. But even for that there is a
solution now via XML::Saxon::XSLT2, by the way, but your problem
certainly does not seem worth the trouble.



On Mon, Mar 21, 2011 at 2:34 PM, Michael Ludwig <[email protected]> wrote:
> You replied off-list; please keep replies on-list.
>
> Charlie Hanpru schrieb am 21.03.2011 um 07:49 (-0400):
>>
>> I have thought about using XSLT but this Perl script is to run on a
>> Un*x platform and IT won't install a XSLT processor like Saxon.
>
> They can install libxml2 and the Perl interface.
>
>> Can what I want be easily done with just Perl?
>
> I'd say no: it seems to me that it's not worth the effort.
>
> Michael
>
>> > Date: Fri, 18 Mar 2011 21:47:09 +0100
>> > From: [email protected]
>> > To: [email protected]
>> > Subject: Re: Read/Write file, break lines at 256 (or more) but NOT elements
>> >
>> > Charlie Hanpru schrieb am 17.03.2011 um 08:55 (-0400):
>> > >
>> > > I have Perl script that reads in a xml file. Adds carriage returns
>> > > in fron of specific elements then write the results to a TMP file.
>> > > The problem I am having is if there is a tag with multiple
>> > > attributes it will get broken in the middle which I can't have.
>> > > How do I break the lines at 256 characters (or more) but NOT a
>> > > tag?
>> >
>> > You're using a non-XML tool (Text::Wrap) to process XML.
>> >
>> > To achieve what you want, use XSLT (@strip-space and @indent set),
>> > call it from a Perl script where you register a hook to process the
>> > text nodes and apply the formatting you want.
> _______________________________________________
> Perl-XML mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs