Outputting a !DOCTYPE declaration from an XSL stylesheet
-
Actually, now I have a working solution, but I'm getting the idea it's bad practice, and wanted to know if it is. I enclose EVERYTHING in a:
xsl:text
<!CDATA[[
<!-- There's a bunch of XHTML here,
including the xml processing instruction and the
DOCTYPE, but it's parsed as simply text. Is
this good practice? Because it's convenient! -->
]]>
</xsl:text>section. It works, and it's very convienient. Whenever I want to output something using template rules, I simply end if with a
]]></xsl:text>
, write the xsl element, then restart it with the<xsl:text><!CDATA[[
. But... this just seems kind of wrong... but it works... but it seems wrong... but... so, what do you think?-Domenic Denicola- [CPUA 0x1337] MadHamster Creations "I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
Domenic [_Geek_n] wrote: But... this just seems kind of wrong... but it works... but it seems wrong... but... so, what do you think? It works, just like using pantyhose to fix a broken fan-belt in a car works. However as soon as you can you should get a new proper fan-belt, right? I had a crushing deadline which forced me to use the
xsl:text
method to output the DOCTYPE. However what happened was that when a third party tried to programatically query my XSL documents to gather some info for an integration project they failed to get the DOCTYPE. I eventually re-coded my XSL docs to use theoutput
method. So the answer is; Yes it works but don't do it if you can avoid it. Your XSL docs will be technically better and easier to maintain in the future if you use the properoutput
method. regards, Paul Watson Bluegrass Cape Town, South Africa The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge "Reports of my death have been greatly exaggerated."