Liam,
Thank you for your help! (And to all the other list members that helped with
this issue I send my "Thanks!")
The final solution, because I have a deadline, is to simply pre-process all XML
files using Perl regex (quick and easy), removing the empty <bold></bold>
elements.
Kind regards,
Raymond Lillibridge
Sr. Software Engineer
rlillibridge(_at_)municode(_dot_)com
Municipal Code Corporation | Facebook | Twitter
-----Original Message-----
From: Liam R E Quin [mailto:liam(_at_)w3(_dot_)org]
Sent: Wednesday, January 16, 2013 1:53 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Saxon 9.4 <bold></bold> Transformed to (newline)</bold>
Problem
On Wed, 2013-01-16 at 17:53 +0000, Raymond Lillibridge wrote:
Here is an update for this thread.
Due to my need to process the output file further, using Perl (reading
line by line), I need the paragraph content to not have any newlines
or white-space introduced. I also cannot use the @indent="no"
attribute due to existing post process Perl applications.
Here's an (untested) example getline() that turns <bold> </bold> into <bold/>.
The technique is to read a line at a time but to read multiple lines when
necessary.
Better yet is not to use line-at-a-time processing at all on a file format
that's not line oriented... however, I do this a lot as part of converting
line-oriented texts into XML.
Liam
sub getline()
{
my $line = <>;
return undef unless $line;
while ($line =~ m{<bold>[^<>]*$}) {
my $tmp = <>;
if (!defined $tmp) { # EOF
die "end of input inside <bold> element! oh dear!";
}
$line .= $tmp;
}
$line =~ s{<bold>\s*</bold>}{<bold/>}g;
return $line;
}
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures
from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--