[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] xsl/xhtml: passing through comments
Hi Sam, The following-sibling axis means any sibling that follows, not necessarily the immediately following sibling. To test the immediately following sibling, you need to add a [1] position counter. I think you need something like this: <xsl:if test="not(following-sibling::node()[1][self::comment()])"> This selects the first node of any kind that follows, and then tests to see if it is a comment. (I didn't test this, but I think it will work). Bob Stayton Sagehill Enterprises DocBook Consulting bobs@sagehill.net ----- Original Message ----- From: "Sam Steingold" <sds@gnu.org> To: <docbook-apps@lists.oasis-open.org> Sent: Monday, July 18, 2005 12:12 PM Subject: [docbook-apps] 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> </xsl:text> > <xsl:comment><xsl:value-of select="normalize-space(.)"/></xsl:comment> > <xsl:if test="not(following-sibling::comment())"> > <xsl:text> </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. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]