Re: AW: [xsl] import/include and apply-imports

Subject: Re: AW: [xsl] import/include and apply-imports
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 10 May 2001 10:19:05 +0100
Hi Marcus,

> We have a problem concerning whitespace.
>
> The HTML output I receive looks something like this:
>
> <title>
>                                                 a value
>                                                 </title>
>
> How can I get rid of the whitespace here? indent="no" and
> xsl:strip-space where of no help.

It depends on where this output is coming from.  If you have something
in the XSLT that literally has:

  <title>
     a value
  </title>

Then you can get rid of the whitespace by getting rid of it in the
stylesheet with:

  <title>a value</title>
or
  <title>
     <xsl:text>a value</xsl:text>
  </title>

If, on the other hand, you're getting it as a value from the source
XML, then you need to normalise the string - cut off the whitespace at
the start and end - with normalize-space():

  <xsl:value-of select="normalize-space(...)" />

xsl:strip-space tells the processor that *whitespace-only* text nodes
should be stripped from certain elements - it doesn't affect
whitespace that occurs within a text node that has other characters in
it as well.

The indent attribute on xsl:output is about adding whitespace
*between* elements to make the XML output more readable, not (again)
about adding or removing whitespace from text nodes that don't consist
entirely of whitespace.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread