Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

CDATA in XSL

  • 01-09-2005 12:03PM
    #1
    Closed Accounts Posts: 658 ✭✭✭


    Hi

    I have a quick question. Basically, at the top of every output file I produce from an input XSL file, i want to print out the XML declaration tag, like this:

    <?xml version="1.0" encoding="ISO-8859-1"?>

    So I put this into my XSL file

    <![CDATA[
    <?xml version="1.0" encoding="ISO-8859-1"?>
    ]]>

    and it appears like so in the output produced:

    "<?xml version="1.0" encoding="ISO-8859-1"?>"

    I've tried a few things like not including the cdata tag and putting in things like &lt and &quot to see could I work it that way.

    Any ideas ?


Comments

  • Closed Accounts Posts: 25 dan_pretty_boy


    Hi pontivic,

    instead of useing CDATA

    why dont you just use <xsl:output method="xml" indent="yes" />


    danny


  • Closed Accounts Posts: 658 ✭✭✭pontovic


    thanks dan

    ill try that now and see how i get on


  • Closed Accounts Posts: 658 ✭✭✭pontovic


    unfortunately that didnt work, but thanks for the help :)


  • Closed Accounts Posts: 658 ✭✭✭pontovic


    Hi

    I managed to find out what to do.

    You need to put in

    <xsl:output method="xml" omit-xml-declaration="no"/>

    near the top of the XSL file for it to output an XML declaration tag at the top of the output file. Put it just after the XSL declaration tag (<xsl:version="2.0"....etc>), and any import statements you have (<xsl:import href=filename....>). That should help any new people like me to XSL who have similar trouble.


Advertisement