<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?&nbsp; Compare that to the generated tree.&nbsp; 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 &lt;thamesvalley-pm-bounces+rafiq.ismail=morganstanley.com@pm.org&gt;<BR>
To: thamesvalley-pm@pm.org &lt;thamesvalley-pm@pm.org&gt;<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&nbsp;<BR>
between manuscripts but have hit a snag. I'm trying to read a text&nbsp;<BR>
file and output it as XML but I can't quite seem to get the&nbsp;<BR>
well-formedness required for XSL Transformation. Any one got any ideas&nbsp;<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 = &quot;C:\\WebRoot\\dickens\\dicktest.txt&quot;;<BR>
my @outputxml;<BR>
my $output = new IO::File(&quot;&gt;c:\\generate.xml&quot;);<BR>
my $count;<BR>
<BR>
#my $writer = new XML::Writer(OUTPUT =&gt; $output, UNSAFE=&gt;1);<BR>
<BR>
open (IN, $read) || die &quot;$file not found\n&quot;;<BR>
@outputxml = &lt;IN&gt;;<BR>
close (IN);<BR>
chomp @outputxml;<BR>
<BR>
$writer-&gt;xmlDecl();<BR>
$writer -&gt;startTag(&quot;text&quot;);<BR>
foreach $write ( @outputxml) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $count++;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $writer -&gt;startTag(&quot;lineno&quot;);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $writer-&gt;characters($count);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $writer-&gt;endTag(&quot;lineno&quot;);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $writer -&gt;startTag(&quot;line&quot;);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $writer-&gt;characters($write);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $writer-&gt;endTag(&quot;line&quot;);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
$writer-&gt;endTag(&quot;text&quot;);<BR>
<BR>
$writer-&gt;end();<BR>
$output-&gt;close();<BR>
<BR>
The stage after that is where I need to query a file (though it might&nbsp;<BR>
move to a db table) to match line numbers so that if there is a&nbsp;<BR>
difference, a div tag enabling a JavaScript box can be inserted. Is&nbsp;<BR>
there a Perlish way of doing this or does it need to be done inside&nbsp;<BR>
the XSL Transformation?<BR>
<BR>
Any advice gratefully accepted as I'm trying to get some proof of&nbsp;<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>