Re: [xsl] how to trigger a new page sequence, depending on specific input conditions

Subject: Re: [xsl] how to trigger a new page sequence, depending on specific input conditions
From: "Tony Graham" <tgraham@xxxxxxxxxx>
Date: Sun, 2 Oct 2011 13:11:58 +0100 (IST)
On Sun, October 2, 2011 1:44 am, team wise wrote:
> I am after a proper sort of method how to trigger a new page sequence,
> depending on specific input conditions.
> For example, as input, below is a content model XML with xtrf
> attribute featuring an unique identifier, such as GUID-1234,
> <concept>
>  <title xtrf="GUID-1234">
>   Explore and get support
>  </title>
>  <conbody/>
> </concept>

I, for one, am not sure what you are after.  What comes before and after
this <concept>?  Is it nested within several levels of elements or is it a
child of the document element?

If the <concept> is a child of the document element, then it might be as
simple as using xsl:for-each-group [1] with 'group-ending-with', e.g.:

<xsl:for-each-group
    select="*"
    group-ending-with="concept[title/@xtrf = 'GUID-1234']">
  <fo:page-sequence ...>
    ...
    <xsl:apply-templates select="current-group()" />
  </fo:page-sequence>
</xsl:for-each>

If you need to do this for multiple specific <context>, you can use a
sequence of @xtrf values in the predicate instead, e.g.:

   title/@xtrf = ('GUID-1234', 'GUID-5678')

> The intention is that the above XML content model shall be placed on

It's more commonly referred to as a 'fragment', BTW: 'content model' is a
term from DTDs for the definition of what's allowed in a particular
element.

> the last page of a PDF document with the following rendering effect
>
>   <xsl:if test="$outputformat = 'UG_Booklet_Print'">
>         <xsl:choose>
>           <xsl:when test="position() = last()">
>             <xsl:attribute name="axf:background-color"><xsl:value-of
> select="$background_colour"/></xsl:attribute>
>             <xsl:attribute
> name="color">rgb-icc(#CMYK,0%,0%,0%,0%)</xsl:attribute>
>           </xsl:when>

Presumably the 'last()' is for this particular <concept> only?

Regards,


Tony Graham                                   tgraham@xxxxxxxxxx
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL FO and XSLT consulting, training and programming

[1] http://www.w3.org/TR/xslt20/#xsl-for-each-group

Current Thread