Re: [xsl] Capture stray carriage returns?

Subject: Re: [xsl] Capture stray carriage returns?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Mar 2024 22:40:58 -0000
On 13/03/2024 23:32, dvint@xxxxxxxxx wrote:
I'm trying to convert some XML/DITA content to asciidoc/flat text
file. asciidoc is very picky about where spaces and blank lines occur.

Typically I would just use a catch all template possibly with some
modes assigned

<xsl:template match="text()" />

And just process specific element content directly and this seems to
handle the problem of extra blank lines (my particular problem

I think I chose not to do this for my current task because I need the
bulk of the test to be processed (rather than looking for specific
content to extract). So I have something like this:

<xsl:strip-space elements="*"/>

<xsl:template match="text()" >
B  <xsl:value-of select="normalize-space()"/>

I believe this is working correctly for space in the elements but I'm getting stray blank lines that I can't find a way to control. I think these blank lines are coming from the pretty printed XML source.

In an XML output I wouldn't worry about these blank lines, but in this
flat file, I need to tighten up my result.

- do you agree this is the source of the blank lines?

How do you feed the input to the XSLT processor? As a stream or file so
that it can do the xsl:strip-space or as a tree where perhaps that
stripping is not done?

But you let us speculate.

Running/debugging code seems easier.

Current Thread