If you want to force a newline in the serialisation you need to special
case the newline from the standard xml normalisation, I use @ here but any
character guaranteed not to be in the input would work
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
exclude-result-prefixes="xs math xd"
version="3.0">
<xsl:output use-character-maps="nl"/>
<xsl:character-map name="nl">
<xsl:output-character character="@" string=" "/>
</xsl:character-map>
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p><xd:b>Created on:</xd:b> Apr 2, 2024</xd:p>
<xd:p><xd:b>Author:</xd:b> graydon</xd:p>
<xd:p></xd:p>
</xd:desc>
</xd:doc>
<xsl:mode on-no-match="shallow-copy"/>
<xd:doc>
<xd:desc>increment the instance number</xd:desc>
</xd:doc>
<xsl:template match="xsl:variable[@name eq 'punctuationNameMap']/@select">
<xsl:attribute name="select" select="replace(.,' {7}','@ ')"/>
</xsl:template>
</xsl:stylesheet>
On Wed, 3 Apr 2024 at 01:16, David Carlisle d.p.carlisle@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>
> On Wed, 3 Apr 2024 at 00:28, Graydon graydon@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>> On Tue, Apr 02, 2024 at 09:19:29PM -0000, Michael Kay
>> michaelkay90@xxxxxxxxx scripsit:
>> > Well, `file:write` isn't going to add any whitespace, it will be some
>> process prior to that (which you haven't shown us).
>>
>> If I boil the whole thing down to a simple example, if I start with:
>>
>>
> so you are adding the space, not the xslt system.
>
> In an xml attribute the xml parser will normalise newlines to a space so
> you are adding 9 spaces before each key of the map from a newline and 8
> spaces.
> You could replace . in replace(.,'''','') by normalize-space(.) or
> replace(.,' ','') depending how aggressively you want to remove space.
>
> David
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)
|