wood burning stoves*
The moose likes XML and Related Technologies and the fly likes Outputting comments in HTML file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Outputting comments in HTML file" Watch "Outputting comments in HTML file" New topic
Author

Outputting comments in HTML file

Donna Meyer
Greenhorn

Joined: Sep 12, 2000
Posts: 21
I have a big problem I'm hoping someone can help me with as I have exhausted all my brain cells over it! I have a code-driven HTML display application that uses (believe it or not) comment codes as its code. I now have to convert an XML document to this HTML document outputting these codes also. So I have the following:
<!--code:code--><P>This is an HTML paragraph</P>
I have tried everything from <xsl:text Disable...> to <xsl: text> to <![CDATA[ output. The disabling works, but it views it as a comment and removes it from the HTM doc on output. I have to be able to maintain its display as above.
Please ANY suggestions??
Thanks so much in advance,
Donna
Zoe Peng
Ranch Hand

Joined: Nov 27, 2000
Posts: 112
did u try to use < or <..to help u out?
try..might work.
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
HI Donna!
There is <xsl:comment> instruction for doing it. In your caase it will be:
<xsl:comment>code:code</xsl:comment><P>This is an HTML paragraph</P>

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Donna Meyer
Greenhorn

Joined: Sep 12, 2000
Posts: 21
"<" doesn't work and the comment string outputs the those word <xsl:comment>, etc. I have to have this translate exactly ... <!--code:code>. How about some kind of macro? Is there such a thing to call out when needed?
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Donna, how did you get <xsl:comment> in the output? Just curiuos. I am getting <!--code:code--> ...
another variant: <xsl:copy-of>
xml:
<?xml version="1.0"?>
<root>
<!--code:code-->
<P>This is an HTML paragraph</P>
</root>
xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="P">
<xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="comment()">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
output:
<!--code:code-->
<P>This is an HTML paragraph</P>
Donna Meyer
Greenhorn

Joined: Sep 12, 2000
Posts: 21
Map,
OH MY WORD! You won't believe what I was doing wrong! I forgot the <xsl: in front & back of the <xsl:comment> code so it was giving me the literal meaning. It isn't actually being used in the XML ... just in the my XSL conversion.
I'm so sorry to have taken up your time with this. However, thanks so much for pointing out the obvious for me with your example or I would probably be bald by tomorrow!
Thanks again,
Donna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Outputting comments in HTML file