[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Inserting commented elements into output file

Subject: Inserting commented elements into output file
From: "Steve Schwarz" <saschwarz@xxxxxxxxxxx>
Date: Thu, 12 Jun 2003 03:02:25 +0000
steve schwarz
Hi
I've been scratching my head on this and can't figure out a solution. I have some XML documents that I'm converting to HTML and I am putting the same boilerplate RDF content into every file. I can get the RDF content into the html file but I can't figure out how to wrap the RDF content with a comment to make it acceptable by old browsers.


A boiled down version of my stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:strip-space elements="*"/>


<xsl:template match="/">
<html><head>
<title>test</title>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/1.0/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/1.0/">
  <requires rdf:resource="http://web.resource.org/cc/Attribution" />
  <requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
  <permits rdf:resource="http://web.resource.org/cc/Reproduction" />
  <permits rdf:resource="http://web.resource.org/cc/Distribution" />
  <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
  <prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
  <requires rdf:resource="http://web.resource.org/cc/Notice" />
</License>
</rdf:RDF>
</head>
<body></body>
</html>
</xsl:template>
</xsl:stylesheet>

which produces:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>test</title>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/1.0/"></license>
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/1.0/">
<requires rdf:resource="http://web.resource.org/cc/Attribution"></requires>
<requires rdf:resource="http://web.resource.org/cc/ShareAlike"></requires>
<permits rdf:resource="http://web.resource.org/cc/Reproduction"></permits>
<permits rdf:resource="http://web.resource.org/cc/Distribution"></permits>
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"></permits>
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"></prohibits>
<requires rdf:resource="http://web.resource.org/cc/Notice"></requires>
</License>
</rdf:RDF>
</head>
<body></body>
</html>


But I'd like to produce the following (where the rdf:RDF element is surrounded by comments):
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>test</title>
<!--
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/1.0/"></license>
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/1.0/">
<requires rdf:resource="http://web.resource.org/cc/Attribution"></requires>
<requires rdf:resource="http://web.resource.org/cc/ShareAlike"></requires>
<permits rdf:resource="http://web.resource.org/cc/Reproduction"></permits>
<permits rdf:resource="http://web.resource.org/cc/Distribution"></permits>
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"></permits>
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse"></prohibits>
<requires rdf:resource="http://web.resource.org/cc/Notice"></requires>
</License>
</rdf:RDF>
-->
</head>
<body></body>
</html>


I've tried wrapping the <rdf> element with <xsl:comment> but Xalan doesn't like that; I've tried building the comments from <xsl:text> and <xsl:value-of select... with concat> but I can't find a syntax that is acceptable. I sure this must be trivial and I'm just not getting it.

Thank you for any assistance,
Steve Schwarz

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.