xsl-list
[Top] [All Lists]

Re: [xsl] Condition Based Count of Sections

2007-04-13 03:47:04
Abel Braaksma wrote:
J. S. Rawat wrote:

<sect2 count="2" level="1.1.1">
<ti>SECT2: SECTION TITLE</ti>
<p>Paragraph 1: PC DATA IS HERE</p>
<p>Paragraph 2: PC DATA IS HERE</p>
</sect2>
...

It is towards the direction but
1. <sect2> should not count because its parent <sect1> does not have any <p>

??
You could do something like:
<xsl:if test="not(self::sect2 and parent::sect1/p)" >
  ...

around your xsl:attribute statements.


Perhaps better to change your match clause, which does away the xsl:if. I.e., change:

<xsl:template match="chapter[p] | sect1[p] | sect2[p] | sect3[p]">

into:

<xsl:template match="chapter[p] | sect1[p] | sect2[p][../sect1/p] | sect3[p][../(sect1 | sect2)/p]">

If you stick to XSLT 1.0, you'll have to change the parenthesized expression into two expressions.

-- AB

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