← Prev in month ← Prev in thread

xsl/xhtml: passing through comments

From
Sam Steingold <>
Date
2005-07-18T19:14:16+00:00
ID
Thread
xsl/xhtml: passing through comments
I want to pass through comments from DocBook/XML to XHTML:
------------------------------------------------------------------
<arg><option><link linkend="opt-libdir">-B &lld;</link></option></arg>
<!-- #ifdef UNIX -->
<arg><option><link linkend="opt-link-set">-K
   <replaceable>linking-set</replaceable></link></option></arg>
<!-- #endif -->
------------------------------------------------------------------
===>
------------------------------------------------------------------
[<code class="option"><a href="#opt-libdir">-B <em class="replaceable"><code>lisp-lib-dir</code></em></a></code>]
<!--#ifdef UNIX-->
[<code class="option"><a href="#opt-link-set">-K
   <em class="replaceable"><code>linking-set</code></em></a></code>]
<!--#endif-->
------------------------------------------------------------------

I have this:

------------------------------------------------------------------
<xsl:template match="comment()">  <!-- pass through comments -->
 <xsl:text>&#10;</xsl:text>
 <xsl:comment><xsl:value-of select="normalize-space(.)"/></xsl:comment>
 <xsl:if test="not(following-sibling::comment())">
  <xsl:text>&#10;</xsl:text></xsl:if>
</xsl:template>
------------------------------------------------------------------

for some reason, the last "xsl:if" does not work: I do not get the
newline after <!--#ifdef UNIX-->, I get a space instead:

------------------------------------------------------------------
<!--#ifdef UNIX--> [<code class="option"><a href="#opt-link-set">-K
   <em class="replaceable"><code>linking-set</code></em></a></code>]
------------------------------------------------------------------

why?

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.iris.org.il> <http://www.dhimmi.com/> <http://ffii.org/>
<http://pmw.org.il/> <http://www.camera.org> <http://www.jihadwatch.org/>
The world is coming to an end.  Please log off.
← Prev in month ← Prev in thread