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: team wise <dfanster@xxxxxxxxx>
Date: Sun, 2 Oct 2011 21:52:43 +0800
Many thanks Tony for your prompt reply which I found 'insightful'!

 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?

--->In the context of the top level DITA Map , yes, that <concept> is
the child of the document element.
<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>
--->
I forgot mentioning that with <fo: break-before name=bpageb/>, I made
the bspecificb concept XML fragment distinct, therefore the
@xtrf=bGUID-1234b should be replaced with
bconcept[title/@outputclass=bpagebreakb]b>

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')
o 
--->
Considering the xtrf value, such as GUID-1234' is bvariableb and not
predictable until at the publishing time, which means that it can only
be determined and fetched when users specify the bcontextb. How can I
apply that syntax?


Presumably the 'last()' is for this particular <concept> only?
-->o exactly right.

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




--
Keep an Exacting Eye for Detail

Current Thread