Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Outputting a !DOCTYPE declaration from an XSL stylesheet

Outputting a !DOCTYPE declaration from an XSL stylesheet

Scheduled Pinned Locked Moved XML / XSL
xmlquestionlearninghtmlcom
21 Posts 4 Posters 87 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Domenic Denicola

    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..."

    P Offline
    P Offline
    Paul Watson
    wrote on last edited by
    #21

    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 the output 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 proper output 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."

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups