|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Inserting commented elements into output file
>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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








