<HTML >
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Re: [Thamesvalley-pm] Well-formed XML query and query on furthertransformation</TITLE>
</HEAD>
<BODY >
<DIV>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hi Iain,<BR>
<BR>
Sorry for the top-post.<BR>
<BR>
What is the error you're getting from the xslt processor? Compare that to the generated tree. From my first look, however, I spotted a couple of points:<BR>
<BR>
O you might want to set $/=undef before slurping the file.<BR>
O you have the unsafe option turned on in XML writer; diabling this may show you the error prior to processing any stylesheets - how ever the characters method, as I remember, should escape any illegal characters.<BR>
<BR>
If you're just putting this into a webpage and the zml is just a transitory state to facilitate xslt, perhaps a more perlish way would be to use one of the template libraries, passing in a data structure containing any diffs you've found<BR>
<BR>
The presentation logic to create the divs can live in the template.<BR>
<BR>
Just a bunch of thoughts.<BR>
<BR>
Raf<BR>
<BR>
<BR>
<BR>
<BR>
***Sent from blackberry***<BR>
<BR>
----- Original Message -----<BR>
From: thamesvalley-pm-bounces+rafiq.ismail=morganstanley.com@pm.org <thamesvalley-pm-bounces+rafiq.ismail=morganstanley.com@pm.org><BR>
To: thamesvalley-pm@pm.org <thamesvalley-pm@pm.org><BR>
Sent: Fri Apr 11 13:32:05 2008<BR>
Subject: [Thamesvalley-pm] Well-formed XML query and query on furthertransformation<BR>
<BR>
<BR>
I'm currently working on a text parser to work out the differences <BR>
between manuscripts but have hit a snag. I'm trying to read a text <BR>
file and output it as XML but I can't quite seem to get the <BR>
well-formedness required for XSL Transformation. Any one got any ideas <BR>
on a better way of doing this?<BR>
<BR>
#!c:\perl\bin\perl.exe<BR>
<BR>
use strict;<BR>
use warnings;<BR>
<BR>
use XML::Writer;<BR>
use IO::File;<BR>
<BR>
my $write;<BR>
my $read = "C:\\WebRoot\\dickens\\dicktest.txt";<BR>
my @outputxml;<BR>
my $output = new IO::File(">c:\\generate.xml");<BR>
my $count;<BR>
<BR>
#my $writer = new XML::Writer(OUTPUT => $output, UNSAFE=>1);<BR>
<BR>
open (IN, $read) || die "$file not found\n";<BR>
@outputxml = <IN>;<BR>
close (IN);<BR>
chomp @outputxml;<BR>
<BR>
$writer->xmlDecl();<BR>
$writer ->startTag("text");<BR>
foreach $write ( @outputxml) {<BR>
$count++;<BR>
$writer ->startTag("lineno");<BR>
$writer->characters($count);<BR>
$writer->endTag("lineno");<BR>
$writer ->startTag("line");<BR>
$writer->characters($write);<BR>
$writer->endTag("line");<BR>
}<BR>
$writer->endTag("text");<BR>
<BR>
$writer->end();<BR>
$output->close();<BR>
<BR>
The stage after that is where I need to query a file (though it might <BR>
move to a db table) to match line numbers so that if there is a <BR>
difference, a div tag enabling a JavaScript box can be inserted. Is <BR>
there a Perlish way of doing this or does it need to be done inside <BR>
the XSL Transformation?<BR>
<BR>
Any advice gratefully accepted as I'm trying to get some proof of <BR>
concept code running by the end of the month.<BR>
MTIA,<BR>
<BR>
Iain<BR>
--<BR>
<BR>
Iain Emsley<BR>
<BR>
Blog: www.yatterings.com<BR>
Mobile: 07942 259725<BR>
_______________________________________________<BR>
Thamesvalley-pm mailing list<BR>
Thamesvalley-pm@pm.org<BR>
<A HREF="http://mail.pm.org/mailman/listinfo/thamesvalley-pm">http://mail.pm.org/mailman/listinfo/thamesvalley-pm</A><BR>
</FONT>
</P>
</DIV>
<DIV>
<HR>
</DIV>
<P CLASS="BulletedList" STYLE="MARGIN: 0in 0in 0pt; TEXT-INDENT: 0in; mso-list: none; tab-stops: .5in"><SPAN STYLE="FONT-SIZE: 8pt; COLOR: gray; mso-bidi-font-family: Arial"><FONT FACE="Arial" COLOR="gray" SIZE="1">NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.</FONT></SPAN></P>
<DIV>
</DIV></BODY></HTML>