Click to See Complete Forum and Search --> : [RESOLVED] [Please move to the XML forum] domdocument transformnode


pupito
May 16th, 2007, 04:23 PM
Please move to the XML forum.

It's possible avoid that transformNode begins the output string with <?xml version='1.0'?>

For example:

XML content:



<?xml version="1.0"?>
<Lista>

<Pelicula>
<Id>100</Id>
<Titulo>12 Monos</Titulo>
</Pelicula>

<Pelicula>
<Id>101</Id>
<Titulo>La nave de la muerte</Titulo>
</Pelicula>

</Lista>



XSL Content:



<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<xsl:for-each select="Lista/Pelicula">
<xsl:value-of select="format-number(number(Id),'000000')"/>
<xsl:value-of select="Titulo"/>
</xsl:for-each>

</xsl:template>

</xsl:stylesheet>



The result of the transformation is:

<?xml version='1.0'?>00010012 Monos000101La nave de la muerte...

I expects:

00010012 Monos000101La nave de la muerte...

Is this possible?

Thanks

wildfrog
May 16th, 2007, 04:50 PM
First of all a valid XML document must begin with the xml declaration. But, your transformation doesn't have to output valid XML.

Take a look at the xsl:output (http://www.w3.org/TR/1999/REC-xslt-19991116#output) element.

- petter

pupito
May 16th, 2007, 05:05 PM
I don't want to return valid XML

<xsl:output method="text"/> Works fine

Thank you!