convert XML using XSL to a file without end tags for individual elements
Hi,
I am using javax.xml.transform.Transformer to transform an XML input file using XSL. However for the output file I want non well formed XML. I want to remove the end tags for individual elements. Is this possible using Transformer?
My input file is of the form:
<address>
<name>
<name1>abc</name1>
<name2>efg</name2>
</name>
</address>
I want to convert it to the following:
<address>
<name>
<name1>abc
<name2>efg
</name>
</address>
If I leave out end tags in the XSL I get a SAXParseException from the transformer. Can this be done using the Transformer? If so what would the XSL look like? thanks
Message was edited by:
bbuff1
[832 byte] By [
bbuff1a] at [2007-10-3 3:29:20]

I have tried it with
<xsl:output method="text"/>
in the XSL file. I have also added the line
transformer.setOutputProperty(OutputKeys.METHOD,"text") in the method that does the transform.
All this does is cause the the output to be limited to anything within <xsl:text></xsl:text> in the XSL.
Unfortunately I cannot use <xsl:text></xsl:text> to hardcode the output. It has to pull the text from the input XML.
I just tried some little experiments and when I tried it, <xsl:value-of> also produced data in the output document. So if you want to copy a <name1> element in that crippled way:<xsl:text><</xsl:text><xsl:value-of select="name()"/><xsl:text>></xsl:text><xsl:value-of select="text()"/>or something like that should work just fine.