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]
# 1
It would have something like this near the beginning:<xsl:output method="text"/>
DrClapa at 2007-7-14 21:23:06 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

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.

bbuff1a at 2007-7-14 21:23:06 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

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>&lt;</xsl:text><xsl:value-of select="name()"/><xsl:text>&gt;</xsl:text><xsl:value-of select="text()"/>or something like that should work just fine.

DrClapa at 2007-7-14 21:23:06 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
That worked with some modification. I had to add <xsl:text disable-output-escaping="yes"><name></xsl:text>><xsl:value-of select="text()"/>. The disable-output-escaping is also necessary. Thanks.
bbuff1a at 2007-7-14 21:23:06 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...