Subject: [xsl] Inserting commented elements into output file From: Joseph Kesselman <keshlam@xxxxxxxxxx> Date: Thu, 12 Jun 2003 09:35:58 -0400 |
>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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Inserting commented eleme, Jarno . Elovirta | Thread | [xsl] Statistics - Calculating Stan, Hugh Dixon |
[xsl] accessing node not belonging , Frank Herrmann | Date | [xsl] doctype declaration and msxml, Whitney, Dan (CanWes |
Month |