Skip to main content
Participant
October 15, 2009
Question

Remove xml declarations when using xslt

  • October 15, 2009
  • 1 reply
  • 2861 views

Hi, i have created an xslt which transforms an xml file and then imports the information into a mysql database. It works and imports the information into the database but it also brings across the xml delcarations and the node names.

Is there a coldfusion way to remove these declarations, all i want is the information itself brought into the database.

Thanks

Chris

This topic has been closed for replies.

1 reply

Inspiring
October 19, 2009

G'day

One doesn't do it via CF, one does it via the XSLT itself.

Have a read of this: http://www.w3schools.com/xsl/el_output.asp

--

Adam

blitzlonAuthor
Participant
October 19, 2009

Hi Adam,

thanks for the reply. I did go to the site and tried using that option but its still including the declarations, could it be a configuration problem?

Thanks, Chris.

Inspiring
October 22, 2009

Hi Adam,

the HTML, Body tags etc are fine, they can stay, its the actual tags that surround the results that i want to get rid of. When i look at the source code, the results show up like this: <?xml version="1.0" encoding="UTF-8"?><EANNumber>111222333444</EANNumber>. I only want the 111222333444, i dont want the surrounding tags.

Thanks

Chris


Right.

Well I think you better post your actual code in its entirety then.  Because when I slap <cfxml> tags around each of the XSL and XML you provide, and do an xmlTransForm() on them, I just get the numbers (and all the other HTML crap), but no <EANNumber> tags. I get *exactly* what I posted before.

My code is thus:

<cfxml variable="xXsl">

[YOUR XSL HERE]

</cfxml>

<cfxml variable="xXml">

[YOUR XML HERE]

</cfxml>
<cfoutput>#xmlTransform(xXml, xXsl)#</cfoutput>

That outputs what I cited above.

--

Adam