RE: [xsl] Re: Wrapping problem

Subject: RE: [xsl] Re: Wrapping problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 14 Aug 2006 08:00:36 +0100
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@xxxxxxxxxxx]
> Sent: 14 August 2006 06:58
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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
> >>
> >
> > ------------------------------
> >
> > Date: Sun, 13 Aug 2006 12:50:25 +0530
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > From: Ashutosh Bhardwaj <ashubhardwaj@xxxxxxxxxx>
> > Subject: Re: [xsl] Removing Duplicate Nodes
> > Message-id: <44DED2B9.9040309@xxxxxxxxxx>
> >
> > 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
> >>
> >>
> > 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[@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[@NAME='docvector']
> > ,'1]'),','),'['))">-->
> > <xsl:variable name="thekeyword"
> >
> select="substring-after(substring-before(substring-before(FIELD[@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[@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@xxxxxxxxxxxxxxxxxxxxxx
> > From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
> > Subject: Re: [xsl] Removing Duplicate Nodes
> > Message-ID:
> > <74a894af0608130233o2741a4f1o629f48a2b55e0ab4@xxxxxxxxxxxxxx>
> >
> > On 8/13/06, Ashutosh Bhardwaj <ashubhardwaj@xxxxxxxxxx> 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[@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[@NAME='docvect
> > or']
> >  ,'1]'),','),'['))[1])][position() &lt;= 8]" mode="col"/>
> >
> > cheers
> > andrew
> >
> > ------------------------------
> >
> > Date: Sun, 13 Aug 2006 12:47:25 +0100
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > From: Luuk Jansen <subscribe@xxxxxxxxxxxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-Id: <1155469645.2772.3.camel@xxxxxxxxxxxxxxxxxxxxx>
> >
> > On Sat, 2006-08-12 at 20:32 +0100, andrew welch wrote:
> >> On 8/12/06, Luuk Jansen <subscribe@xxxxxxxxxxxxxxxxx> 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="....."
> >>
> >
> > 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@xxxxxxxxxxxxxxxxxxxxxx
> > From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID:
> > <74a894af0608130554j1e6e03fw816cc9a6caa60bc1@xxxxxxxxxxxxxx>
> >
> > On 8/13/06, Luuk Jansen <subscribe@xxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxx
> > From: Florent Georges <darkman_spam@xxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID: <20060813125906.95092.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> >
> > 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
> >
> >
> >
> ______________________________________________________________________
> > _____ Dicouvrez un nouveau moyen de poser toutes vos
> questions quelque
> > soit le sujet !
> > Yahoo! Questions/Riponses pour partager vos connaissances, vos
> > opinions et vos expiriences.
> > http://fr.answers.yahoo.com
> >
> > ------------------------------
> >
> > Date: Sun, 13 Aug 2006 15:12:27 +0200 (CEST)
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > From: Florent Georges <darkman_spam@xxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID: <20060813131227.43718.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> >
> > 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
> >
> >
> >
> ______________________________________________________________________
> > _____ Dicouvrez un nouveau moyen de poser toutes vos
> questions quelque
> > soit le sujet !
> > Yahoo! Questions/Riponses pour partager vos connaissances, vos
> > opinions et vos expiriences.
> > http://fr.answers.yahoo.com
> >
> > ------------------------------
> >
> > Date: Sun, 13 Aug 2006 14:52:34 +0100
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > From: Luuk Jansen <subscribe@xxxxxxxxxxxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-Id: <1155477154.2783.17.camel@xxxxxxxxxxxxxxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxxxxxxxxx>
> > From: "Michael Kay" <mike@xxxxxxxxxxxx>
> > Subject: RE: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID: <001d01c6bee4$1f71f220$6401a8c0@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@xxxxxxxxxxxxxxxxxxxxxx>
> > From: "Michael Kay" <mike@xxxxxxxxxxxx>
> > Subject: RE: [xsl] Problem with embeded XHTML in an XML file
> > andtransformation to XSL:FO
> > Message-ID: <002101c6bee4$ccbe91e0$6401a8c0@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
> >>
> >
> > ------------------------------
> >
> > Date: Sun, 13 Aug 2006 17:20:08 +0200 (CEST)
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > From: Florent Georges <darkman_spam@xxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID: <20060813152008.946.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> >
> > 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
> >
> >
> >
> ______________________________________________________________________
> > _____ Dicouvrez un nouveau moyen de poser toutes vos
> questions quelque
> > soit le sujet !
> > Yahoo! Questions/Riponses pour partager vos connaissances, vos
> > opinions et vos expiriences.
> > http://fr.answers.yahoo.com
> >
> > ------------------------------
> >
> > Date: Sun, 13 Aug 2006 21:15:49 +0100
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID:
> > <74a894af0608131315m62324629u3fb4e36f215f9dad@xxxxxxxxxxxxxx>
> >
> > On 8/13/06, Florent Georges <darkman_spam@xxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxx
> > From: "andrew welch" <andrew.j.welch@xxxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID:
> > <74a894af0608131317y7e91db4bh630baff1fe5aed18@xxxxxxxxxxxxxx>
> >
> > On 8/13/06, Florent Georges <darkman_spam@xxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxx
> > From: Florent Georges <darkman_spam@xxxxxxxx>
> > Subject: Re: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID: <20060813203751.35258.qmail@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> >
> > 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
> >
> >
> >
> ______________________________________________________________________
> > _____ Dicouvrez un nouveau moyen de poser toutes vos
> questions quelque
> > soit le sujet !
> > Yahoo! Questions/Riponses pour partager vos connaissances, vos
> > opinions et vos expiriences.
> > http://fr.answers.yahoo.com
> >
> > ------------------------------
> >
> > Date: Sun, 13 Aug 2006 22:04:38 +0100
> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> > From: "Michael Kay" <mike@xxxxxxxxxxxx>
> > Subject: RE: [xsl] Problem with embeded XHTML in an XML file and
> > transformation to XSL:FO
> > Message-ID: <004601c6bf1c$16d62400$6401a8c0@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
> > ***********************************

Current Thread