Subject: Re: [xsl] I output a tab character, then the output file contains space, tab, space ... why? From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 8 Apr 2016 15:21:08 -0000 |
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
select="codepoints-to-string(9)"/>
<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"
<xsl:template match="/"> <xsl:for-each select="$headers"> <xsl:sequence select="." /> <xsl:sequence select="$field-separator"/> </xsl:for-each>
As for the reason, see https://www.w3.org/TR/xslt20/#constructing-complex-content and item 3 saying
Any consecutive sequence of strings within the result sequence is converted to a single text node, whose string value contains the content of each of the strings in turn, with a single space (#x20) used as a separator between successive strings.
--- Diese E-Mail wurde von Avast Antivirus-Software auf Viren gepr|ft. https://www.avast.com/antivirus
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] I output a tab character,, Martin Honnen martin | Thread | Re: [xsl] I output a tab character,, Michael Kay mike@xxx |
Re: [xsl] I output a tab character,, Martin Honnen martin | Date | Re: [xsl] I output a tab character,, Michael Kay mike@xxx |
Month |