[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
From the XML point of view,
<?php ... ?>
(and its ilk) is certainly a processing instruction. If you are creating XML, you must perforce adopt the XML point of view.
If you are not creating XML but some "bespoke" format, use not <xsl:output method="xml"/> but <xsl:output method="text"/>. Then, of course, you will have to create all tags in your output by hand (including "XML tags" which you've said aren't really XML because you're not creating XML but something else).
If you have the string <?php ... ?> literally in your stylesheet, the parser takes it to be a processing instruction in the input document (the stylesheet): this is correct behavior. But you don't want a PI in your input; you want it in your output, which is where <xsl:processing-instruction> comes in.
The only exception to the rule that the <? ... ?> syntax in XML indicates a processing instruction is the XML declaration <?xml version="1.0"?>, which is a declaration that happens to be disguised as a processing instruction. (This is for backwards compatibility, so that XML will conform to SGML. Although this now seems like an archaic requirement, back in the early days it was a Very Good Thing, allowing XML technologies to leapfrog years of evolution.)
At 06:34 PM 7/23/01, Michael Fitzgerald wrote:
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
RE: [xsl] producing php with xslt
Subject: RE: [xsl] producing php with xslt From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 24 Jul 2001 14:06:54 -0400 |
From the XML point of view,
<?php ... ?>
(and its ilk) is certainly a processing instruction. If you are creating XML, you must perforce adopt the XML point of view.
If you are not creating XML but some "bespoke" format, use not <xsl:output method="xml"/> but <xsl:output method="text"/>. Then, of course, you will have to create all tags in your output by hand (including "XML tags" which you've said aren't really XML because you're not creating XML but something else).
If you have the string <?php ... ?> literally in your stylesheet, the parser takes it to be a processing instruction in the input document (the stylesheet): this is correct behavior. But you don't want a PI in your input; you want it in your output, which is where <xsl:processing-instruction> comes in.
The only exception to the rule that the <? ... ?> syntax in XML indicates a processing instruction is the XML declaration <?xml version="1.0"?>, which is a declaration that happens to be disguised as a processing instruction. (This is for backwards compatibility, so that XML will conform to SGML. Although this now seems like an archaic requirement, back in the early days it was a Very Good Thing, allowing XML technologies to leapfrog years of evolution.)
Regards, Wendell
At 06:34 PM 7/23/01, Michael Fitzgerald wrote:
It's not a PI, but it looks like a PI. You can use xsl:processing-instruction to produce the desired output, nonetheless. Otherwise, you could use CDATA sections, which might be compared to goto statements in C. The Kernighan and Ritchie description of goto is apt for CDATA sections: "infinitely-abusable." [1]
-Mike
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] producing php with xslt, Michael Fitzgerald | Thread | Re: [xsl] producing php with xslt, Kevin Nardi |
[xsl] weird behavior with last(), Nathan Shaw | Date | Re: [xsl] weird behavior with last(, Thomas B. Passin |
Month |
Keywords