[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

detecting text between nodes

Subject: detecting text between nodes
From: "Uwe Janner" <xsl@xxxxxxxxx>
Date: Thu, 24 Feb 2005 17:59:02 +0100
uwe janner
dear xsl-specialists,

i try write an xsl to transform html-documents (with a restricted
html-subset) directly to fo.

my only problem is the <br/>-tag:
if i have "aaa<br/>bbb<br/>ccc"
then i simply have to replace each br-tag with a <fo:block/> just to insert
a line-break.

but if i have "aaa<br/><br/>bbb" the first br is responsible for the
line-break and the second will insert an empty line, i.e. i have to convert
the second br-tag to something that inserts an empty line:
"aaa<fo:block/><fo:block space-after="10"/>bbb"

so, the attribute "space-after=10" is present if the preceding sibling is a
"br" and there is nothing except whitespace between the current br and the
preceding br;

but how can i express this condition with xpath?

<xsl:template match="br">
  <fo:block>
    <xsl:if test="name(./preceding-sibling::*[1])='br' and
NOTHINGBUTWHITESPACEBETWEEN(.,./preceding-sibling::*[1])">
      <xsl:attribute name="space-after">10pt</xsl:attribute>
    </xsl:if>
  </fo:block>
</xsl:template>


tia for any hint!

fusel!

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.