[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: Joseph Kesselman <keshlam@xxxxxxxxxx>
Date: Thu, 12 Jun 2003 09:35:58 -0400
msxml skip past declarations



>I've tried wrapping the <rdf> element with <xsl:comment> but Xalan doesn't

>like that;

>From the XSLT 1.0 spec: "It is an error if instantiating the content of
xsl:comment creates nodes other than text nodes." (One can quibble about
whether that's the best answer, but you'd have to take that up with the
XSLT 2.0 Working Group.)

You need to generate the comment's content in text, rather than structural,
form. That means writing templates which convert elements into their text
equivalents -- essentially, a modified version of the identity transform
which extracts all the info and re-presents it as text rather than just
copying it over. Ugly but doable.

Personal reaction: You may want to rethink your requirements. If you're
having to generate something inside comments, the tool consuming this
document may be considered broken by today's evolving standards. A properly
written namespace-aware client should be able to recognize whether the rdf:
namespace is meaningful to it or not, and skip past that element if not.
While I agree that it would be nice if XSLT offered the option of
generating comments that contain element syntax, I believe fairly strongly
that using that for anything more than documentation is the Wrong Answer;
it was OK as a stopgap while we waited for namespaces to arrive, but should
now be a deprecated practice.


______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


 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.