Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?
2016-04-08 10:24:50
I would use string-join for this:
<xsl:sequence select="string-join($headers,$field-separator)"/>
The for-each loop is not needed.
Someone can correct me but I believe in your code the rules for sequence
construction come into play meaning that the string result of a sequence
always includes a space between items, so you're creating a sequence of
("A", "\t", "B"), which becomes "A \t B".
Cheers,
Eliot
----
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com
On 4/8/16, 11:13 AM, "Costello, Roger L. costello(_at_)mitre(_dot_)org"
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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>
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Costello, Roger L. costello(_at_)mitre(_dot_)org
- Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de
- Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de
- Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Michael Kay mike(_at_)saxonica(_dot_)com
- Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?,
Eliot Kimber ekimber(_at_)contrext(_dot_)com <=
- Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Costello, Roger L. costello(_at_)mitre(_dot_)org
- Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Costello, Roger L. costello(_at_)mitre(_dot_)org
- Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Eliot Kimber ekimber(_at_)contrext(_dot_)com
|
Previous by Date: |
Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Michael Kay mike(_at_)saxonica(_dot_)com |
Next by Date: |
Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Costello, Roger L. costello(_at_)mitre(_dot_)org |
Previous by Thread: |
Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Michael Kay mike(_at_)saxonica(_dot_)com |
Next by Thread: |
Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why?, Costello, Roger L. costello(_at_)mitre(_dot_)org |
Indexes: |
[Date]
[Thread]
[Top]
[All Lists] |
|
|