> -----Original Message-----
> From: Forest, Sebastien [mailto:[EMAIL PROTECTED]

> Hi

Hi

Some friendly advice to start:
Would you be so kind the next time, to post in plain-text? Not a problem for
me specifically, but some would find it a reason to ignore your question if
you don't... Just imagine for a moment what all that HTML looks like in
plain text view.

Now as to your question:
> When I encounter the tag I create a new page-sequence but FOP give me an
error
> because the page-sequence must be in the fo:root and not in a fo:block.
> I'am able to change page-sequence, but only if the tag I'm looking for is
at
> the root. If this tag ("graphic" in my example) is a child of another tag
I
> didn't find a way to control it.

I think you're going to need three XSL templates for this:
(more of a Mulberry-question, come to think of it)

- one for the plain <para .../> elements (sans graphiques ;) )
- one for the <graphic .../> elements that are children of the root
- one to handle <graphic /> elements with <para .../> ancestors

Example stylesheet:

<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml" />

<xsl:template match="wp">
  <foroot>
    <xsl:apply-templates select="para[not(descendant::graphic)]
                                 | //graphic" />
  </foroot>
</xsl:template>

<xsl:template match="para[not(descendant::graphic)]">
  <xsl:choose>
  <xsl:when test="parent::wp">
    <fopageseq ref="a">
      <foblock>
        <xsl:apply-templates />
      </foblock>
    </fopageseq>
  </xsl:when>
  <xsl:otherwise>
    <foblock>
      <xsl:apply-templates />
    </foblock>
  </xsl:otherwise>
  </xsl:choose>
</xsl:template>

<xsl:template match="graphic[parent::wp]">
  <fopageseq ref="b">
    <foextgraph src="{.}" />
  </fopageseq>
</xsl:template>

<xsl:template match="graphic[ancestor::para]">
  <fopageseq ref="a">
    <xsl:for-each select="ancestor::para">
      <xsl:sort select="position()" order="ascending" />
        <foblock>
          <xsl:value-of select="text()" />
        </foblock>
    </xsl:for-each>
  </fopageseq>
  <fopageseq ref="b">
    <foextgraph src="{.}" />
  </fopageseq>

</xsl:template>

</xsl:stylesheet>

Modify this to use real fo's, and use it to transform your example XML. Only
case not handled by the above template is: a <para> that would be following
'graphic 4' in your example, but would still be a child of the 'para 5'
node... Just to give you an idea.


Cheers,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to