OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] xsl/groff(&xhtml): keep comments


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>&#10;.&#92;&#34;</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="'&#10;'"/>
>    <xsl:with-param name="replacement" select="'&#10;.&#92;&#34;'"/>
>   </xsl:call-template>
>  </xsl:variable>
>  <xsl:value-of select="normalize-space($content)"/>
>  <xsl:if test="not(following-sibling::comment)">
>   <xsl:text>&#10;</xsl:text></xsl:if>
> </xsl:template>
> 
> it does not quite work:
> 
> 1. the last part:
> 
>  <xsl:if test="not(following-sibling::comment)">
>   <xsl:text>&#10;</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


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]