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

Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?


Subject: Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Apr 2016 15:22:12 -0000

The XSLT rules for constructing complex content say that if you output two
adjacent strings, a space character will be inserted between them. There are
many ways to avoid this, but Martin Honnen's suggestion seems the simplest.

Michael Kay
Saxonica

> On 8 Apr 2016, at 16:13, Costello, Roger L. costello@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi Folks,
>
> In the below XSLT program I loop over each value in a sequence and separate
the sequence values by a tab (hex 9) character. When I open the output file in
a hex editor I see 3 characters separating the sequence values: space (hex
20), tab (hex 9), and space (hex 20). Why am I getting those space characters?
How do I avoid getting them?  /Roger
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                           version="2.0">
>
>    <xsl:output method="text" />
>
>    <xsl:variable name="headers" select="('A', 'B')"/>
>    <xsl:variable name="field-separator" select="codepoints-to-string(9)"/>
>
>    <xsl:template match="/">
>        <xsl:for-each select="$headers">
>            <xsl:sequence select="." />
>            <xsl:sequence select="$field-separator"/>
>        </xsl:for-each>
>    </xsl:template>
>
> </xsl:stylesheet>


Current Thread
Keywords