This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]