Subject: RE: [xsl] Saxon 9.4 <bold></bold> Transformed to (newline)</bold> Problem From: Raymond Lillibridge <RLillibridge@xxxxxxxxxxxx> Date: Thu, 17 Jan 2013 15:27:18 +0000 |
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@xxxxxxxxxxxx Municipal Code Corporation | Facebook | Twitter -----Original Message----- From: Liam R E Quin [mailto:liam@xxxxxx] Sent: Wednesday, January 16, 2013 1:53 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Saxon 9.4 <bold></bold> T, Liam R E Quin | Thread | [xsl] xsl for-each and preceding-si, Raimund Kammering |
[xsl] XML Prague Call for Poster 20, Jim Fuller | Date | [xsl] Pencil and Paper UTF-8, Gannon Dick |
Month |