Hi,
I think you will find that your solution works in some locations but not
others. Since the PI generates an <xsl:attribute> element, it must be
processed right after an output element is opened but before any content is
added to it. In your para example it will work, but most likely in other
places it will generate an error message and not work because the template
already generated some content before it does xsl:apply-templates (which
triggers the processing of the PI).
I don't think there is a general solution for using a processing
instruction to insert a keep (or any other) property. But if it works in
the situations you need, then your implementation is fine.
Bob Stayton
Sagehill Enterprises
DocBook Consulting
[EMAIL PROTECTED]
----- Original Message -----
From: "Johnson Earls" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 25, 2007 3:06 PM
Subject: [docbook-apps] Best way to implement author-specified
keep-with-next options?
Hello!
In the document I'm working on, I'm finding a need to specify the
keep-with-next option in several places. Since docbook-xsl 1.73.0
doesn't seem to provide this by itself, I came up with the following
simplistic approach. Is this the "right" way to do things?
<!-- ---------------- in FO customization layer: ---------------- -->
<!--
Custom processing instruction target: NeoBook
-->
<xsl:template match="processing-instruction('NeoBook')">
<xsl:variable name="keep.with.next">
<xsl:call-template name="pi-attribute">
<xsl:with-param name="pis" select="." />
<xsl:with-param name="attribute"
select="'keep-with-next'" />
</xsl:call-template>
</xsl:variable>
<xsl:if test="$keep.with.next != ''">
<xsl:attribute name="keep-with-next.within-column">
<xsl:value-of select="$keep.with.next" />
</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- ---------------- in document: ---------------- -->
<para><?NeoBook keep-with-next="always"?>
text of paragraph goes here
</para>
<para>
The previous paragraph will always be kept
with this paragraph.
</para>
<!-- ---------------- ---------------- -->
Thanks in advance!
- Johnson
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who
knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]