xsl-list
[Top] [All Lists]

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

2011-10-02 08:52:57
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=”page”/>, I made
the ‘specific’ concept XML fragment distinct, therefore the
@xtrf=’GUID-1234’ should be replaced with
“concept[title/@outputclass=’pagebreak’]”>

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


Presumably the 'last()' is for this particular <concept> only?
-->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(_at_)mentea(_dot_)net
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

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




-- 
Keep an Exacting Eye for Detail

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