Re: [xsl] Problem with embeded XHTML in an XML file and transformation to XSL:FO

Subject: Re: [xsl] Problem with embeded XHTML in an XML file and transformation to XSL:FO
From: Luuk Jansen <subscribe@xxxxxxxxxxxxxxxxx>
Date: Sun, 13 Aug 2006 14:52:34 +0100
On Sun, 2006-08-13 at 15:12 +0200, Florent Georges wrote:

>   But as the argument of saxon:parse() is a string, not a text node,
> the only solution I see is to have a string namespace-well-formed:
> 
>     <root>&_lt;ns:elem xmlns:ns="doc"/></root>
> 

I added &lt;ns:elem xmlns:ns="doc"/> to the beginning of the text
element and am a step further (I think) as it gives me a next error:

Error on line 1 column 27 of file:///home/Luuk/workspace/ATFM%
20Solutions/:
  SXXP0003: Error reported by XML parser: The markup in the document
following the root
  element must be well-formed.
Error on line 1048575 of file:///home/Luuk/workspace/ATFM%
20Solutions/xsl/xhtml2fo.xsl:
  net.sf.saxon.trans.DynamicError: org.xml.sax.SAXParseException: The
markup in the document
  following the root element must be well-formed.
net.sf.saxon.trans.DynamicError: org.xml.sax.SAXParseException: The
markup in the document following the root element must be well-formed.

Am I just opening a can of worms here?
It is probably something basic, but my brain is fried at this stage...

The XML parsed is show below, where the content bit is processed with
the next part of the stylesheet:

  <xsl:template match="Content" xmlns:saxon="http://saxon.sf.net/";
>      
	        <xsl:if test=". != ''">
	        	<fo:block space-after="10mm">
		      		<xsl:variable name="parseContent" select="saxon:parse(.)"/>
					<xsl:value-of select="$parseContent"/>    				
	           	</fo:block>
           	</xsl:if>
  </xsl:template>

___

The XML: 

<?xml version="1.0" encoding="UTF-8"?>
<Sections>
   <Section>
      <Title>Technical Summary</Title>
      <IE.SFI.4400>
	        <Content Version="1.0" type="XHTML">&lt;ns:elem
xmlns:ns="doc"/&gt;&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;bla bla bla  class="MsoNormal" style="margin-top: 6pt; text-align: justify; text-indent: 21.25pt; font-family: times new roman;"&gt;&lt;font size="3"&gt;&lt;span style="font-size: 12pt;"&gt;

&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class="MsoNormal" style="margin-top: 6pt; text-align: justify;
text-indent: 21.25pt; font-family: times new roman;"&gt;&lt;font
size="3"&gt;&lt;span lang="EN-GB" style="font-size: 12pt;"&gt;bla bla
bla &amp;#945;2-bla bla bla &amp;#945;2-bla bla
bla.&lt;/span&gt;&lt;span style="font-size:
12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;


&lt;p class="MsoNormal" style="margin-top: 6pt; text-align: justify;
text-indent: 21.25pt; font-family: times new roman;"&gt;&lt;font
size="3"&gt;&lt;span lang="EN-GB" style="font-size:
12pt;"&gt;&amp;#945;2-bla bla bla
&lt;/span&gt;&lt;/font&gt;&lt;span style="font-size: 12pt;"&gt;&lt;font
size="3"&gt;&lt;span style="font-size: 12pt;" lang="EN-GB"&gt;bla bla
bla &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="3"&gt;&lt;span
lang="EN-GB" style="font-size: 12pt;"&gt;groups.&lt;/span&gt;&lt;span
style="font-size:
12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;


&lt;p class="MsoNormal" style="margin-top: 6pt; text-align: justify;
text-indent: 21.25pt; font-family: times new roman;"&gt;&lt;font
size="3"&gt;&lt;span lang="EN-GB" style="font-size: 12pt;"&gt;bla bla
bla:&lt;/span&gt;&lt;span style="font-size:
12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;


&lt;p class="MsoNormal" style="margin-top: 6pt; margin-left: 63.8pt;
text-align: justify; text-indent: -35.25pt; font-family: times new
roman;"&gt;&lt;font size="3"&gt;&lt;span lang="EN-GB" style="font-size:
12pt;"&gt;1)&lt;/span&gt;&lt;span lang="EN-GB" style="font-size:
7pt;"&gt;             &lt;/span&gt;&lt;span lang="EN-GB"
style="font-size: 12pt;"&gt;model the &amp;#945;2-bla bla bla
&amp;#8216;&lt;i&gt;in silico&lt;/i&gt;&amp;#8217; test
&amp;#945;2-adrenoceptor
antagonists. &lt;/span&gt;&lt;span style="font-size:
12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;


&lt;p class="MsoNormal" style="margin-top: 6pt; margin-left: 63.8pt;
text-align: justify; text-indent: -35.25pt; font-family: times new
roman;"&gt;&lt;font size="3"&gt;&lt;span lang="EN-GB" style="font-size:
12pt;"&gt;2)&lt;/span&gt;&lt;span lang="EN-GB" style="font-size:
7pt;"&gt;         
&lt;/span&gt;&lt;span lang="EN-GB" style="font-size: 12pt;"&gt;bla bla
bla &lt;/span&gt;&lt;span style="font-size:
12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;


&lt;p class="MsoNormal" style="margin-top: 6pt; margin-left: 63.8pt;
text-align: justify; text-indent: -35.25pt; font-family: times new
roman;"&gt;&lt;font size="3"&gt;&lt;span lang="EN-GB" style="font-size:
12pt;"&gt;3)&lt;/span&gt;&lt;span lang="EN-GB" style="font-size:
7pt;"&gt;               
&lt;/span&gt;&lt;span lang="EN-GB" style="font-size:
12pt;"&gt;evaluate&lt;span style="color: red;"&gt; &lt;/span&gt;bla bla
bla
&amp;#945;2-bla bla bla.&lt;/span&gt;&lt;span style="font-size:
12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;


&lt;p class="MsoNormal" style="margin-top: 6pt; text-align: justify;
text-indent: 21.25pt; font-family: times new roman;"&gt;&lt;font
size="3"&gt;&lt;span lang="EN-GB" style="font-size: 12pt;"&gt;The
applicant&amp;#8217; bla bla bla
&lt;/span&gt;&lt;st1:country-region&gt;&lt;st1:place&gt;&lt;span
lang="EN-GB" style="font-size:
12pt;"&gt;Ireland&lt;/span&gt;&lt;/st1:place&gt;&lt;/st1:country-region&gt;&lt;span lang="EN-GB" style="font-size: 12pt;"&gt; with such capability.&lt;/span&gt;&lt;span style="font-size: 12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-top: 6pt; text-align: justify;
text-indent: 21.25pt; font-family: times new roman;"&gt;&lt;font
size="3"&gt;&lt;span lang="EN-GB" style="font-size:
12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/body&gt;&lt;/html&gt;</Content>
		       <Attachments Version="1.0">
		          <Attachment context="" mimeType="" name="">
			            <Link/>
			            <Comment author="" timestamp=""/>
			            <Property name=""/>
		          </Attachment>
	        </Attachments>
      </IE.SFI.4400>
   </Section>
</Sections>

Tanks again!

Luuk

Current Thread