This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] xsl/groff(&xhtml): keep comments
- From: Bob Stayton <bobs at sco dot com>
- To: Sam Steingold <sds at gnu dot org>
- Cc: docbook-apps at lists dot oasis-open dot org
- Date: Tue, 27 May 2003 15:31:51 -0700
- Subject: Re: [docbook-apps] xsl/groff(&xhtml): keep comments
- References: <m3n0hcuqsy.fsf@loiso.podval.org>
On Sat, May 24, 2003 at 02:45:33PM -0400, Sam Steingold wrote:
> I want to keep comments from xml in the groff (and xhtml) output.
> I use this:
>
> <xsl:template match="comment()">
> <xsl:text> .\"</xsl:text> <!-- #\Newline . \ " -->
> <xsl:variable name="content">
> <xsl:call-template name="string.subst">
> <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
> <xsl:with-param name="target" select="' '"/>
> <xsl:with-param name="replacement" select="' .\"'"/>
> </xsl:call-template>
> </xsl:variable>
> <xsl:value-of select="normalize-space($content)"/>
> <xsl:if test="not(following-sibling::comment)">
> <xsl:text> </xsl:text></xsl:if>
> </xsl:template>
>
> it does not quite work:
>
> 1. the last part:
>
> <xsl:if test="not(following-sibling::comment)">
> <xsl:text> </xsl:text></xsl:if>
>
> which is supposed to output a newline only if the next element is
> _not_ a comment, outputs a newline _always_.
>
In:
<xsl:if test="not(following-sibling::comment)">
you are testing for an element named 'comment'.
It doesn't exist, so the not() makes it true and
you get your newline.
I think you need to use the node test 'comment()' instead:
<xsl:if test="not(following-sibling::comment())">
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
The SCO Group fax: (831) 429-1887
email: bobs@sco.com
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org