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

Re: Continuing problem. &NotaWhitespace;?

Subject: Re: Continuing problem. &NotaWhitespace;?
From: John Ericson <john@xxxxxxxxxx>
Date: Thu, 1 Nov 2001 18:36:25 +0000
normalized string
On Nov 01 16:20, Jeni Tennison wrote:
> Ah. OK, then you need the info template to just apply templates to
> all its children as before, and you need to do some clever business
> within the text() template to work out what to do. I think that the
> rules are that it should emit the normalized string, plus:
> 
>   * a space before the normalized string if there is a normalized
>     string and the original string had whitespace as its first
>     character
> 
>   * a space after the normalized string if there is a normalized
>     string and the original string had whitespace as its last
>     character
> 
> This gives you a template like:
> 
> <xsl:template match="text()">
>   <xsl:variable name="normalizedString" select="normalize-space()" />
>   <xsl:if test="not(normalize-space(substring(., 1, 1)))">
>     <xsl:text> </xsl:text>
>   </xsl:if>
>   <xsl:value-of select="$normalizedString" />
>   <xsl:if test="not(normalize-space(substring(., string-length())))">
>     <xsl:text> </xsl:text>
>   </xsl:if>
> </xsl:template>

This is more like what I thought of, but this has the problem of that if
the line contains several whitespaces in the beginning it will get *one*
whitespace added to the beginning. It should have none in that case.

Instead of the code on line 3:

	<xsl:if test="not(normalize-space(substring(., 1, 1)))">

I would like to write something like this:

	<xsl:if test="contains(substring(., 1, 2),' &NotaWhitespace;')">

Where &NotaWhiteSpace; is some wildcard that includes every letter except
whitespace and newline. Does it exist something like that?

This would put *one* whitespace infront of the line who begins with *one*
whitespace, not several.


-- 
* John Ericson john@xxxxxxxxxx
* ICQ: 7325429 JID: high@xxxxxxxxxx
* web: http://john.pp.se

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


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.