[XSL-LIST Mailing List Archive Home]
RE: [xsl] inserting HTML comments
Subject: RE: [xsl] inserting HTML comments|
From: "Babos, Andras" <ababos@xxxxxxxxxxxxx>
Date: Thu, 4 Nov 2004 21:13:49 +0100
An update on the situation:
I've tried a few different XSL processors to see whether any of them
handles this <PRE> situation correctly. Here's the result:
1. Xalan-C++ 1.8: The whole solution works (all my various templates are
processed as expected) except for this tiny little bug with the <PRE>
2. Libxslt 1.1.12: Two problems:
- it inserts newlines into the output as Xalan (as a matter of fact
Libxslt inserts even more...)
- it simply skips my apply-templates directives (these have a
parameter passed, but AFAIK that's valid)
3. Sablotron 1.0.1: Completely broken. Cannot even pass a Windows path
as an input parameter to the stylesheet. (All the others handled at
least this well.)
4. MSXSL 4.0: Guess what? It works! Surprise... Too bad that I need a
processor which works on Mac OS X also.
5. Saxon: Haven't tried, since it's written in Java and I don't want to
include a JVM in the solution.
It looks like I'll have to contact the Xalan developers, and hope that
they are willing to help me in time.
BTW: AFAICT all my stylesheets are XSLT 1.0 conformant. Is there a tool
to check this?
> -----Original Message-----
> From: Babos, Andras [mailto:ababos@xxxxxxxxxxxxx]
> Sent: 2004. november 2. 16:31
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] inserting HTML comments
> Hi All,
> I seem to have a problem with inserting HTML comments in the HTML
> of an
> XSL transformation.
> The problem description is as follows:
> 1. I have an XML file from which I generate the HTML output.
> 2. In the XSL file I have a template which contains something like
> <xsl:text>some text node </xsl:text>
> <xsl:call-template name="insert-anchor">
> <xsl:with-param name="anchor" select="someNode"/>
> 3. and the insert-anchor template looks something like:
> <xsl:template name="insert-anchor">
> <xsl:comment> This is a comment </xsl:comment>
> <xsl:attribute name="HREF">
> <xsl:value-of select="concat (string (someNode), '.html')"/>
> <xsl:value-of select="string (someNode)"/>
> 4. I'd expect the output to look like this:
> <PRE><B>some text node </B><!-- This is a comment --><A
> 5. but instead I get this:
> <B>some text node </B>
> <!-- This is a comment -->
> <A HREF="value-of-someNode.html">value-of-someNode</A>
> 6. However, if I don't insert the <B> tags around the text node, I get
> <PRE>some text node <!-- This is a comment --><A
> What I need is the comment placed _right before_ the anchor tag
> kind of whitespace inbetween (and of course no whitespace inserted
> a <PRE>
> tag at all).
> Some more background info:
> 1. I'm using Xalan-C 1.8 with Xerces-C 2.5.0 (Windows).
> 2. I do have the xsl:output element set to html and indent="yes", but
> even if I
> turn off the indentation, the problem persists.
> 3. Of course my original templates are somewhat more comlicated than
> these, but
> I think the whole problem boils down to the mentioned parts. If you
> think it
> may help I can post a more detailed template.
> 1. Is this behaviour XSL inherent or XSL processor dependant?
> 2. If it is the former, then how could I achieve what I'm trying to
> Andras Babos.
- RE: [xsl] inserting HTML comments, (continued)
- Babos, Andras - Tue, 2 Nov 2004 16:43:51 +0100
- Babos, Andras - Tue, 2 Nov 2004 17:57:18 +0100
- Pieter Reint Siegers Kort - Tue, 2 Nov 2004 16:50:01 -0600
- Babos, Andras - Wed, 3 Nov 2004 12:19:33 +0100
- Babos, Andras - Thu, 4 Nov 2004 21:13:49 +0100 <=
- Babos, Andras - Fri, 5 Nov 2004 11:41:18 +0100
- Babos, Andras - Fri, 5 Nov 2004 12:51:50 +0100