[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Testing the Content of the Next Node


Subject: Testing the Content of the Next Node
From: Stewart Unwin <sunwin@xxxxxxxxxx>
Date: Fri, 10 Mar 2000 09:22:01 +1100

I have an XML fragment :

<biblentry>
  <title>The cat sat on the mat</title>
  <body>/ David Jones</body>
</biblentry>
<biblentry>
  <title>The fox jumped over the dog</title>
  <body>Sydney : ABC Press, 1987</body>
</biblentry>

What I want to achieve is output like this :

The cat sat on the mat / David Jones
The fox jumped over the dog. Sydney : ABC Press, 1987

i.e., if the first character in the following element "body" is "/", add a
space to the end of title, otherwise add a fullstop/period and a space.

This template does not seem to work in Excelon's Stylus processor:

<xsl:template match="title">
  <xsl:value-of select="."/>
  <xsl:if test="starts-with(following-sibling::body,/)"> </xsl:if>
  <xsl:if test="not(starts-with(following-sibling::body,/))">. </xsl:if>
</xsl:template>

Grateful for any advice.


Stewart Unwin
Web Services Branch
National Library of Australia

Tel: +61-2 6262 1544
Fax: +61-2 6273 3648
E-mail: sunwin@xxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml