Archiv

Artikel Tagged ‘XML’

Leerzeichen / Space ausgeben

12. September 2007 TheSimple Keine Kommentare
Any whitespace you're putting in there is getting trimmed since the
stylesheet doesn't see its own whitespace-only text nodes as significant.
(The earlier text node ', ' isn't getting trimmed since it's not
whitespace-only.)

The solution is to say
<xsl:text> </xsl:text>

or if you like,
<xsl:value-of select=" "/>

should get you the same thing. Note this is a space, not a non-breaking
space, which would be another way to go -- just use   (no <xsl:text>
necessary in that case since it's not "whitespace only" -- the non-breaking
space character isn't considerd "whitespace" for these purposes.)

Another Hints
You can use an <xsl:text> element to introduce a (real) space character:

<xsl:value-of select="../HEADER/FROM/STATE"/>
<xsl:text> </xsl:text>
<xsl:value-of select="../HEADER/FROM/ZIP1"/>

or

<xsl:value-of select="../HEADER/FROM/STATE"
/> <xsl:value-of select="../HEADER/FROM/ZIP1"/>

or you can insert a non-breaking space character (  in HTML) if that is
more appropriate:

<xsl:value-of select="../HEADER/FROM/STATE"
/> <xsl:value-of select="../HEADER/FROM/ZIP1"/>
KategorienXML & XSL Tags: