← Prev in month ← Prev in thread
Next in thread → Next in month →

Re: Selecting the last para in a CAUTION

From
Norman Walsh <>
Date
2006-04-12T20:14:36+00:00
ID
Thread
Re: Selecting the last para in a CAUTION
/ "David White" <> was heard to say:
| Hell all,

It sure feels like it some days :-)

This question would be better sent to the docbook-apps list, but...

| I have a bit of code thats giving me grief:
|
| <warning  role="danger" conformance="0000055">
| <title  lang="en">EXPLOSION!</title>
| <itemizedlist>
| <listitem>
| <para  lang="en">blah<para>
| </listitem>
| <listitem>
| <para  lang="en">blah</para>
| </listitem>
| </itemizedlist>
| <para  lang="en">0000007en</para>
| </warning>
|
| Here is my XSLT code:

What is the context where this code is evaluated? It looks like it
must be match="para", but I'm not sure what you expect of the test in
that case.

| <xsl:choose>
| <xsl:when test="ancestor-or-self::warning/para[position()=last()]">
| <fo:block xsl:use-attribute-sets="admonition.insert_number.properties" >
| <xsl:apply-templates/>
| </fo:block>
| <xsl:otherwise>
| <fo:block xsl:use-attribute-sets="admonition.properties">
| <xsl:apply-templates/>
| </fo:block>
| </xsl:otherwise>
| </xsl:choose>
|
| I want the XSLT code to only apply admonition.insert_number.properties to
| the LAST /warning/para element or the ONLY /warning/para element if there is
| only 1.

Assuming your in a para and just want to know if it's the last para
in a warning, I'd try:

<xsl:choose>
  <xsl:when test="parent::warning and not(following-sibling::para)">
    <fo:block xsl:use-attribute-sets="admonition.insert_number.properties" >
      <xsl:apply-templates/>
    </fo:block>
  </xsl:when>
  <xsl:otherwise>
    <fo:block xsl:use-attribute-sets="admonition.properties">
      <xsl:apply-templates/>
    </fo:block>
  </xsl:otherwise>
</xsl:choose>

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <>      | Resist the urge to hurry; it will
http://www.oasis-open.org/docbook/ | only slow you down--Bruce Eckel
Chair, DocBook Technical Committee |
← Prev in month ← Prev in thread
Next in thread → Next in month →