[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: xsl/groff(&xhtml): keep comments
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_. 2. when the comment is a part of text, e.g.: <varlistentry id="opt-libdir"><term><option>-B</option> <replaceable>lisp-lib-dir</replaceable></term> <listitem><simpara>Specifies the installation directory. This is the directory containing the linking sets and other data files. <!-- #ifdef UNIX --> This option is normally not necessary, because the installation directory is already built-in in the <command>clisp</command> executable. <!-- #endif --> Directory <replaceable>lisp-lib-dir</replaceable> can be changed dynamically using the symbol-macro <varname>*lib-directory*</varname>. </simpara></listitem></varlistentry> it is converted into .TP \fB\-B\fR \fIlisp\-lib\-dir\fR Specifies the installation directory\&. This is the directory containing the linking sets and other data files\&. .\"#ifdef UNIX This option is normally not necessary, because the installation directory is already built\-in in the \fBclisp\fR executable\&. .\"#endif Directory \fIlisp\-lib\-dir\fR can be changed dynamically using the symbol\-macro \fI*lib\-directory*\fR\&. instead of .TP \fB\-B\fR \fIlisp\-lib\-dir\fR Specifies the installation directory\&. This is the directory containing the linking sets and other data files\&. .\"#ifdef UNIX This option is normally not necessary, because the installation directory is already built\-in in the \fBclisp\fR executable\&. .\"#endif Directory \fIlisp\-lib\-dir\fR can be changed dynamically using the symbol\-macro \fI*lib\-directory*\fR\&. 3. When the comments surround a varlistentry element, they simply disappear, _both_ in groff and xhtml! I suspect that 2 and 3 are stylesheet bugs, while 1 stems from my ignorance. tia PS. Thanks to everyone (especially Tim Waugh!) for their help so far! PPS. XHTML: <xsl:template match="comment()"> <!-- pass though 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> -- Sam Steingold (http://www.podval.org/~sds) running RedHat9 GNU/Linux <http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/> <http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html> nobody's life, liberty or property are safe while the legislature is in session
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]