Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

CDATA in XSL

Options
  • 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