I am attempting to write XML converted to plain text into a disk. I
am using XSLT processor to create the text file. However, the generated text contains the XML declaration (<?xml version="1.0" encoding="utf-8"?>) that I can not get rid off. Here is my code: <!-- convert XML to flat file --> <p:processor name="oxf:unsafe-xslt"> <p:input name="data" href="#instance"/> <p:input name="config"> <xsl:stylesheet version="2.0"> <xsl:output media-type="text/plain" include-content- type="no" method="text" omit-xml-declaration="yes"/> ... xslt stylesheet definition ... </xsl:stylesheet> </p:input> <p:output name="data" id="output"/> </p:processor> <!-- convert to file --> <p:processor name="oxf:xml-converter"> <p:input name="data" href="#output"/> <p:input name="config"> <config> <content-type>text/plain</content-type> <encoding>utf-8</encoding> </config> </p:input> <p:output name="data" id="converted-output" debug="output"/> </p:processor> <!-- prepare config for the file-serializer --> <p:processor name="oxf:xslt"> <p:input name="data" href="#instance"/> <p:input name="path" href="#config"/> <p:input name="config"> <xsl:stylesheet version="2.0"> <xsl:template match="/"> <config> <directory> <xsl:value-of select="doc('input:path')/ config/write-path"/> </directory> <file> <xsl:value-of select="concat(replace(/ form/po-number,'\W','_'),substring(replace(xs:string(current-time ()),'\W','_'), 1, 11),'.txt')"/> </file> <content-type>text/plain</content-type> <make-directories>true</make-directories> <encoding>utf-8</encoding> </config> </xsl:template> </xsl:stylesheet> </p:input> <p:output name="data" id="file-ser-config"/> </p:processor> <!-- write request to file --> <p:processor name="oxf:file-serializer"> <p:input name="data" href="#converted-output"/> <p:input name="config" href="#file-ser-config"/> </p:processor> Any idea how to get rid of the declaration? Thanks A. -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Never mind - I was incorrectly using oxf:xml-converter instead of
oxf:text-converter. On Sep 27, 2007, at 1:03 PM, Alexander Zatko wrote: > I am attempting to write XML converted to plain text into a disk. I > am using XSLT processor to create the text file. However, the > generated text contains the XML declaration (<?xml version="1.0" > encoding="utf-8"?>) that I can not get rid off. > > Here is my code: > > <!-- convert XML to flat file --> > <p:processor name="oxf:unsafe-xslt"> > <p:input name="data" href="#instance"/> > <p:input name="config"> > <xsl:stylesheet version="2.0"> > > <xsl:output media-type="text/plain" include-content- > type="no" method="text" omit-xml-declaration="yes"/> > ... > xslt stylesheet definition > ... > > </xsl:stylesheet> > </p:input> > <p:output name="data" id="output"/> > </p:processor> > > <!-- convert to file --> > <p:processor name="oxf:xml-converter"> > <p:input name="data" href="#output"/> > <p:input name="config"> > <config> > <content-type>text/plain</content-type> > <encoding>utf-8</encoding> > </config> > </p:input> > <p:output name="data" id="converted-output" debug="output"/> > </p:processor> > > <!-- prepare config for the file-serializer --> > <p:processor name="oxf:xslt"> > <p:input name="data" href="#instance"/> > <p:input name="path" href="#config"/> > <p:input name="config"> > <xsl:stylesheet version="2.0"> > > <xsl:template match="/"> > <config> > <directory> > <xsl:value-of select="doc('input:path')/ > config/write-path"/> > </directory> > <file> > <xsl:value-of select="concat(replace(/ > form/po-number,'\W','_'),substring(replace(xs:string(current-time > ()),'\W','_'), 1, 11),'.txt')"/> > </file> > <content-type>text/plain</content-type> > <make-directories>true</make-directories> > <encoding>utf-8</encoding> > </config> > </xsl:template> > > </xsl:stylesheet> > </p:input> > <p:output name="data" id="file-ser-config"/> > </p:processor> > > <!-- write request to file --> > <p:processor name="oxf:file-serializer"> > <p:input name="data" href="#converted-output"/> > <p:input name="config" href="#file-ser-config"/> > </p:processor> > > Any idea how to get rid of the declaration? > > Thanks > > A. > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |