[jdom-interest] Regarding Transformation of XML To Text
Laurent Bihanic
laurent.bihanic at atosorigin.com
Mon Aug 18 07:54:12 PDT 2003
Pradeep Gummi wrote:
> Hi All,
> Sorry for posting this question again. I was not clear with the previous
> solution. Please try to answer this again.
> I would like to know is it necessary to have a root element for Text
> format when we are transforming from XML to text format. I have used the
> following tag so as to define the out put as text. <xsl:output
> method="text" indent="yes"/>. I just want to print text with out any
> root element. Any suggestions in transforming XML to text format.
1. No root element is required whether the stylesheet is meant to generate
text or XML. The result of an XSL transformation is a result tree, not a
well-formed XML document.
2. An XSLT processor has no clue about what you are trying to generate. If you
generate only text and use a JDOMResult, you'll get a list of Text nodes. If
you use a StreamResult, you'll get a character stream.
3. <xsl:output> only applies if the transformation output is a StreamResult,
i.e. when the XSLT processor handles the serialization. For any other type of
output (DOMResult, SAXResult, JDOMResult...), this statement is ignored.
Laurent
More information about the jdom-interest
mailing list