Using the latest Saxon parser.
This is a snip of a larger XML file.
<osm>
<node id="38275590">
<tag k="name" v="Wimbledon"/>
</node>
<node id="28377390">
<tag k="name" v="Westminster"/>
</node>
<node id="168325631">
<tag k="name" v="Brixton"/>
</node>
</osm>
This xslt/Xpath:
<xsl:template match="osm">
<xsl:result-document href="{'Underground_Now.txt'}">
<xsl:value-of select="node[tag[@k='railway'][@v='station']]/tag[@k='name']/concat(string(@v),'
')"/>
</xsl:result-document>
</xsl:template>
Returns this (I've used a bullet-point to indicate a space).
Wimbledon
•Westminster
•Brixton
Why is it adding a whitespace to the beginning of each line? Note: It isn't present in the first string.
Even if I remove the linefeed it returns this:
•Westminster•Brixton
I've tried setting:
<xsl:output indent="no"/>
I've tried incorporating normalize-space()
in various forms, such as:
/concat(normalize-space(string(@v)),'
')
...but it produces the same output.
The xsl:value-of
instruction has an optional separator attribute.
If the separator attribute is present, then the effective value of this attribute is used to separate adjacent items in the result sequence, as described in 5.7.2 Constructing Simple Content. In the absence of this attribute, the default separator is a single space (#x20) when the content is specified using the select attribute, or a zero-length string when the content is specified using a sequence constructor.
https://www.w3.org/TR/xslt-30/#value-of