[xsl] Matching two consecutive <br><br>

Subject: [xsl] Matching two consecutive <br><br>
From: "stefan krause" <stefan.krause@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Aug 2004 11:19:35 +0200
Dear all,

I need to distinguish in a mixed content type whether I need to handle
one or two <br> tags (This is used in a FOP transformation to insert
either <fo:block/> or <fo:block>&#160;</fo:block> - if someone has a
better solution for how to distinguish between a TEXT<br>TEXT and
TEXT<br><br>TEXT situation for FOP I'd love to hear about that two. The
first one should cause a line break only and the second one a line break
plus an empty line).

Let's assume the following content.
<text>
  Hello XSL-List,<br/><br/>
  This is a <b>nice</b><br/>
  Day, but I'm too stupid for this simple xsl task.<br/>
  <br/>
  Yours,<br/>
  Stefan
</text>

Can somebody tell me how to create a matching for the second consecutive
br for Xalan? For MSXML the following did work:
	<xsl:template match="br">
		<xsl:choose>
			<xsl:when
test="name(following-sibling::node()[1])='br'">two BRs</xsl:when>
			<xsl:otherwise>one BR (or this is the
second)</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
But this does not work for Xalan 2.
As a rule for the matching it would be OK to just see if the preceding
node it a text node or a node with a different name than "br", but I
can't make that work with Xalan.


Thanks for any help,
Stefan

Current Thread