xsl-list
[Top] [All Lists]

RE: [xsl] Re: Wrapping problem

2006-08-14 00:01:11
This problem is often referred to as "positional grouping", and a search for
that term should give you some pointers.

In XSLT 2.0 it looks like this:

<xsl:template match="play">
  <xsl:for-each-group select="*" group-starting-with="scene">
    <scene name="{.}">
      <xsl:for-each-group select="current-group()"
group-starting-with="character">
        <character name="{.}">
          <xsl:copy-of select="current-group()[self::line]"/>
        </
      </
    </
  </
</

In 1.0 it's much more difficult: the two general approaches are (a) to treat
it as a value-based grouping problem, which you can tackle with Muenchian
grouping, using something like generate-id(preceding-sibling::scene[1]) as
the grouping key, or (b) to do a recursive traversal over the siblings,
using apply-templates select="following-sibling::*[1]" to achieve the
recursion, and terminating each level of recursion when there are no more
elements on the same logical level of the hierarchy.

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Kent Seegmiller [mailto:hookjaw20(_at_)comcast(_dot_)net] 
Sent: 14 August 2006 06:58
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Re: Wrapping problem

My apologies. for not making that clear.  The following is my 
input. I want to wrap a script from a play in a file "movie1.xml":
<play>
   <scene>Scene 1</scene>
      <character>char 1</character>
         <line>blah blah blah</line>
         <line>blah blah blah</line>
         <line>blah blah blah</line>
      <character>char 2</character>
         <line>blah blah blah</line>
         <line>blah blah blah</line>
         <line>blah blah blah</line>
      <character>char 3</character>
         <line>blah blah blah</line>
         <line>blah blah blah</line>
         <line>blah blah blah</line>
   <scene>Scene 2</scene>...
      <character>char 1</character>
         <line>blah blah blah</line>
         <line>blah blah blah</line>
         <line>blah blah blah</line>
...
</play>
 The output I want to look like so:
<play>
    <scene name="Scene 1">
       <character name="char 1">
          <line>blah blah blah</line>
          <line>blah blah blah</line>
          <line>blah blah blah</line>
       </character>
       <character name="char 2">
          <line>blah blah blah</line>
          <line>blah blah blah</line>
          <line>blah blah blah</line>
       </character>
       <character name="char 3">
          <line>blah blah blah</line>
          <line>blah blah blah</line>
          <line>blah blah blah</line>
       </character>
    </scene>
    <scene name="Scene 2">
       <character> name="char 1"
          <line>blah blah blah</line>
          <line>blah blah blah</line>
          <line>blah blah blah</line>
       </character>
 ...</scene>
</play>

My question: How do I wrap the scenes and characters.  So far my 
strained brain can only think of creating a text file and using 
"&lt;scene>" or "&lt;character>" to place the end element then 
renaming the text file to xml.
thanks Kent



--~------------------------------------------------------------------
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>
--~--


------------------------------

Date: Sun, 13 Aug 2006 12:50:25 +0530
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Ashutosh Bhardwaj <ashubhardwaj(_at_)bol(_dot_)net(_dot_)in>
Subject: Re: [xsl] Removing Duplicate Nodes
Message-id: <44DED2B9(_dot_)9040309(_at_)bol(_dot_)net(_dot_)in>

andrew welch wrote:
I am using XSLT 1.0 and trying to use muechian 
grouping,but not able 
to form correct expression. Also I need to get only first 
8 elements 
and break recursion or loop after that.

In which case you will want to read:

http://www.jenitennison.com/xslt/grouping/index.xml

Remember with XSLT you don't break out of a loop, you only 
select the 
nodes you want to process.

Best of luck


--~------------------------------------------------------------------
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>
--~--


With some work I have been able to get all the distinct 
values but I 
don't know how to get only first 8 distinct values :

My XSL goes something like this :

<xsl:apply-templates select="//HIT[generate-id(.) = 
generate-id(key('hit-keyword', 

substring-after(substring-before(substring-before(FIELD[(_at_)NAME='docvect
or']
,'1]'),','),'['))[1])]" mode="col"/>
.
.
.

<xsl:template match="//HIT" mode="col"> <!--<xsl:for-each 

select="key('hit-keyword',substring-after(substring-before(substring-b
efore(FIELD[(_at_)NAME='docvector']
,'1]'),','),'['))">-->
<xsl:variable name="thekeyword"

select="substring-after(substring-before(substring-before(FIELD[(_at_)NAME=
'docvector']
,'1]'),','),'[')"/>
<p><a href="#"

onClick="javascript:document.IntranetSrchFrm.keyword.value='{$thekeywo
rd}';document.IntranetSrchFrm.submit();"><xsl:value-of

select="substring-after(substring-before(substring-before(FIELD[(_at_)NAME=
'docvector']
,'1]'),','),'[')"/></a></p>
<!--</xsl:for-each>-->

</xsl:template>

Any ideas will be appreciated , I have failed to build a correct 
expression for recursion.

thanks,
ashutosh

------------------------------

Date: Sun, 13 Aug 2006 10:33:10 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: "andrew welch" <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com>
Subject: Re: [xsl] Removing Duplicate Nodes
Message-ID: 
<74a894af0608130233o2741a4f1o629f48a2b55e0ab4(_at_)mail(_dot_)gmail(_dot_)com>

On 8/13/06, Ashutosh Bhardwaj <ashubhardwaj(_at_)bol(_dot_)net(_dot_)in> 
wrote:
With some work I have been able to get all the distinct 
values but I 
don't know how to get only first 8 distinct values :

My XSL goes something like this :

<xsl:apply-templates select="//HIT[generate-id(.) = 
generate-id(key('hit-keyword', 

substring-after(substring-before(substring-before(FIELD[(_at_)NAME='docvec
tor']
,'1]'),','),'['))[1])]" mode="col"/>

Add a predicate to select only the first 8, eg [position() &lt;= 8]

<xsl:apply-templates select="//HIT[generate-id(.) =  
generate-id(key('hit-keyword',


substring-after(substring-before(substring-before(FIELD[(_at_)NAME='docvect
or']
 ,'1]'),','),'['))[1])][position() &lt;= 8]" mode="col"/>

cheers
andrew

------------------------------

Date: Sun, 13 Aug 2006 12:47:25 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Luuk Jansen <subscribe(_at_)angelosystems(_dot_)com>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-Id: 
<1155469645(_dot_)2772(_dot_)3(_dot_)camel(_at_)localhost(_dot_)localdomain>

On Sat, 2006-08-12 at 20:32 +0100, andrew welch wrote:
On 8/12/06, Luuk Jansen <subscribe(_at_)angelosystems(_dot_)com> wrote:
Thanks Andrew that works now!

When I said "test the application again" I meant that I 
never trust 
a change in components to behave exactly the same, but it seems 
fine so far except a few errors concerning version.

The system runs though the XML files as it did before, but I get 
the following error:

Error on line 12 column 110 of file:///home/Luuk/workspace/ATFM%
20Solutions/:
  SXXP0003: Error reported by XML parser: The prefix "o" for 
element "o:p" is not bound.
___

This is caused by the <xsl:variable name="htmlContent"
select="saxon:parse(.)"/> command.

Wat does this mean?
I cannot find any such element.

In the example you posted earlier you had:

&lt;o:p&gt;&lt;/o:p&gt;

Once this has been parsed twice you have the element:

<o:p/>

You haven't defined a namespace for the prefix "o" so the 
XML parser 
is throwing the error.  Just define a namespace in your stylesheet 
for
"o":

xmlns:o="....."


--~------------------------------------------------------------------
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>
--~--


All-right, I missed that one, sorry about that.

The namespace is urn:schemas-microsoft-com:office:office as 
I found on 
the internet, but adding into the template as seen below 
doesn't seem 
to work (still gives exactly the same error, so doesn't seen to pay 
any attention to it).

 <xsl:template match="Content"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:saxon="http://saxon.sf.net/";>
        <xsl:if test=". != ''">
        <fo:block space-after="10mm">
      <xsl:variable name="parseContent" select="saxon:parse(.)"/> 
<xsl:apply-templates select="$parseContent"/>
           </fo:block>
          </xsl:if>
 </xsl:template>

Am I doing something stupid wrong?
Sorry for all these newbie questions!

Regards,

Luuk

------------------------------

Date: Sun, 13 Aug 2006 13:54:57 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: "andrew welch" <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: 
<74a894af0608130554j1e6e03fw816cc9a6caa60bc1(_at_)mail(_dot_)gmail(_dot_)com>

On 8/13/06, Luuk Jansen <subscribe(_at_)angelosystems(_dot_)com> wrote:
All-right, I missed that one, sorry about that.

The namespace is urn:schemas-microsoft-com:office:office 
as I found 
on the internet, but adding into the template as seen 
below doesn't 
seem to work (still gives exactly the same error, so 
doesn't seen to 
pay any attention to it).

  <xsl:template match="Content"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:saxon="http://saxon.sf.net/";>
                <xsl:if test=". != ''">
                        <fo:block space-after="10mm">
                                <xsl:variable name="parseContent" 
select="saxon:parse(.)"/>
                                        <xsl:apply-templates 
select="$parseContent"/>
                        </fo:block>
                </xsl:if>
  </xsl:template>

Am I doing something stupid wrong?

Yes - add it to your <xsl:stylesheet> or <xsl:transform> elements...
not at the template level...

Sorry for all these newbie questions!

You do seem to be in at the deep-end...

------------------------------

Date: Sun, 13 Aug 2006 14:59:06 +0200 (CEST)
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Florent Georges <darkman_spam(_at_)yahoo(_dot_)fr>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: 
<20060813125906(_dot_)95092(_dot_)qmail(_at_)web25810(_dot_)mail(_dot_)ukl(_dot_)yahoo(_dot_)com>

Luuk Jansen wrote:

 Hi

The namespace is urn:schemas-microsoft-com:office:office 
as I found 
on the internet, but adding into the template as seen 
below doesn't 
seem to work

 But the binding doesn't miss in the sctylesheet, it miss 
in the input 
of saxon:parse().  The documentation of saxon:parse() doesn't say 
anything specific about the namespace declarations in the 
input.  Just 
that the argument is a string and this string represent an XML 
document.  So I guess this string must contain all used namespace 
binding declarations.

 Regards,

--drkm


p5.vert.ukl.yahoo.com uncompressed/chunked Sun Aug 13 12:13:38 GMT 
2006



______________________________________________________________________
_____ Découvrez un nouveau moyen de poser toutes vos 
questions quelque 
soit le sujet !
Yahoo! Questions/Réponses pour partager vos connaissances, vos 
opinions et vos expériences.
http://fr.answers.yahoo.com

------------------------------

Date: Sun, 13 Aug 2006 15:12:27 +0200 (CEST)
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Florent Georges <darkman_spam(_at_)yahoo(_dot_)fr>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: 
<20060813131227(_dot_)43718(_dot_)qmail(_at_)web25808(_dot_)mail(_dot_)ukl(_dot_)yahoo(_dot_)com>

andrew welch wrote:

 Hi

Yes - add it to your <xsl:stylesheet> or <xsl:transform> 
elements...
not at the template level...

 I can't test that here, and the documentation of saxon:parse() 
doesn't say anything about namespaces.  But are you sure 
saxon:parse() 
take into account the namespace bindings in the context of the 
*expression*?

 It can be usefull when you pass string literals (but I'm 
not sure it 
is usefull).  But when using a text node, I think it is not 
logical to 
use the namespaces in the stylesheet and not those in the 
document the 
text node belongs to.  Compare for example:

   <!-- The document. -->
   <root xmlns:ns="doc">&_lt;ns:elem/></root>

   <!-- Somewhere in the stylesheet. -->
   <xsl:copy-of xmlns:ns="script" select="saxon:first(root)"/>

 What do you expect as the output?

   <ns:elem xmlns:ns="doc"/>

or:

   <ns:elem xmlns:ns="script"/>

 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>

 Regards,

--drkm


p5.vert.ukl.yahoo.com uncompressed/chunked Sun Aug 13 12:13:40 GMT 
2006



______________________________________________________________________
_____ Découvrez un nouveau moyen de poser toutes vos 
questions quelque 
soit le sujet !
Yahoo! Questions/Réponses pour partager vos connaissances, vos 
opinions et vos expériences.
http://fr.answers.yahoo.com

------------------------------

Date: Sun, 13 Aug 2006 14:52:34 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Luuk Jansen <subscribe(_at_)angelosystems(_dot_)com>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-Id: 
<1155477154(_dot_)2783(_dot_)17(_dot_)camel(_at_)localhost(_dot_)localdomain>

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;&l
t;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-regio
n&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

------------------------------

Date: Sun, 13 Aug 2006 15:24:00 +0100
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: <001d01c6bee4$1f71f220$6401a8c0(_at_)turtle>

  But the binding doesn't miss in the sctylesheet, it miss in the 
input of saxon:parse().  The documentation of
saxon:parse() doesn't say anything specific about the namespace 
declarations in the input.  Just that the argument is a string and 
this string represent an XML document.  So I guess this 
string must 
contain all used namespace binding declarations.

Yes, the string must contain a namespace-well-formed XML document.

Michael Kay
http://www.saxonica.com/

------------------------------

Date: Sun, 13 Aug 2006 15:28:52 +0100
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] Problem with embeded XHTML in an XML file 
andtransformation to XSL:FO
Message-ID: <002101c6bee4$ccbe91e0$6401a8c0(_at_)turtle>


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:

The input you are passing to the XML parser now contains an ns:elem 
element followed by an html element. If you typed

<ns:elem xmlns:ns="doc"><html/>

into a text editor and then tried to parse this as an XML document, 
you would get exactly the same error.

Michael Kay
http://www.saxonica.com/


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;bo
dy&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:count
ry-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



--~------------------------------------------------------------------
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>
--~--


------------------------------

Date: Sun, 13 Aug 2006 17:20:08 +0200 (CEST)
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Florent Georges <darkman_spam(_at_)yahoo(_dot_)fr>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: 
<20060813152008(_dot_)946(_dot_)qmail(_at_)web25804(_dot_)mail(_dot_)ukl(_dot_)yahoo(_dot_)com>

Michael Kay wrote:

 Hi

Yes, the string must contain a namespace-well-formed XML document.

 Maybe the documentation could be updated to say 
"namespace-well-formed" instead of "well-formed"?

 Regards,

--drkm


p5.vert.ukl.yahoo.com uncompressed/chunked Sun Aug 13 14:13:38 GMT 
2006



______________________________________________________________________
_____ Découvrez un nouveau moyen de poser toutes vos 
questions quelque 
soit le sujet !
Yahoo! Questions/Réponses pour partager vos connaissances, vos 
opinions et vos expériences.
http://fr.answers.yahoo.com

------------------------------

Date: Sun, 13 Aug 2006 21:15:49 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: "andrew welch" <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: 
<74a894af0608131315m62324629u3fb4e36f215f9dad(_at_)mail(_dot_)gmail(_dot_)com>

On 8/13/06, Florent Georges <darkman_spam(_at_)yahoo(_dot_)fr> wrote:
andrew welch wrote:

  Hi

Yes - add it to your <xsl:stylesheet> or <xsl:transform> 
elements...
not at the template level...

  I can't test that here, and the documentation of saxon:parse() 
doesn't say anything about namespaces.  But are you sure 
saxon:parse() take into account the namespace bindings in 
the context 
of the *expression*?

No I wasn't paying attention (and in a hurry)... of course the 
namespace would need to be declared in the XML being parsed 
and not in 
the stylesheet containing the parse function...

------------------------------

Date: Sun, 13 Aug 2006 21:17:42 +0100
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: "andrew welch" <andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: 
<74a894af0608131317y7e91db4bh630baff1fe5aed18(_at_)mail(_dot_)gmail(_dot_)com>

On 8/13/06, Florent Georges <darkman_spam(_at_)yahoo(_dot_)fr> wrote:
Michael Kay wrote:

  Hi

Yes, the string must contain a namespace-well-formed XML 
document.

  Maybe the documentation could be updated to say 
"namespace-well-formed" instead of "well-formed"?

That's an interesting point - can you have a well-formed 
XML document 
that isn't namespace-well-formed?

Is it that "well-formed" existed before namespaces came 
along, and now 
saying "well-formed" means both?

------------------------------

Date: Sun, 13 Aug 2006 22:37:51 +0200 (CEST)
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: Florent Georges <darkman_spam(_at_)yahoo(_dot_)fr>
Subject: Re: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: 
<20060813203751(_dot_)35258(_dot_)qmail(_at_)web25815(_dot_)mail(_dot_)ukl(_dot_)yahoo(_dot_)com>

andrew welch wrote:

That's an interesting point - can you have a well-formed 
XML document 
that isn't namespace-well-formed?

 The following document is well-formed (as per "Extensible Markup 
Language (XML)") but not namespace-well-formed (as per 
"Namespaces in 
XML"):

   <!-- No namespace declaration. -->
   <a:elem>
     <!-- More than one colon. -->
     <a:b:elem/>
   </a:elem>

Is it that "well-formed" existed before namespaces came along, and 
now saying "well-formed" means both?

 Strictly speaking, I don't think "well-formed" as nothing 
to do with 
namespaces.  A lot of XML tools now support "Namespaces in XML" (so 
restrict the possible document instances), and it is 
convenient to say 
"well-formed" for both the well-formedness defined in the 
XML REC and 
the namespace-well-formedness.

 But I'm not a namespaces expert.  Maybe someone here will can 
confirm.

 Regards,

--drkm


p5.vert.ukl.yahoo.com uncompressed/chunked Sun Aug 13 20:13:39 GMT 
2006



______________________________________________________________________
_____ Découvrez un nouveau moyen de poser toutes vos 
questions quelque 
soit le sujet !
Yahoo! Questions/Réponses pour partager vos connaissances, vos 
opinions et vos expériences.
http://fr.answers.yahoo.com

------------------------------

Date: Sun, 13 Aug 2006 22:04:38 +0100
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] Problem with embeded XHTML in an XML file and 
transformation to XSL:FO
Message-ID: <004601c6bf1c$16d62400$6401a8c0(_at_)turtle>

That's an interesting point - can you have a well-formed 
XML document 
that isn't namespace-well-formed?

Yes, you can. No-one uses them nowadays, but in principle 
you can have 
a document that conforms to the base XML recommendation but doesn't 
conform to the Namespaces Rec. XSLT has always insisted that the 
source document conforms to both.

Is it that "well-formed" existed before namespaces came along, and 
now saying "well-formed" means both?


No, to require both you have to specify "namespace-well-formed".

Michael Kay
http://www.saxonica.com/

------------------------------

End of xsl-list Digest
***********************************


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>