XML/XSL parsing

Atheus

Diamond Member
Jun 7, 2005
7,313
2
0
We are using xerces like this:

org.apache.xerces.parsers.SAXParser parser = new org.apache.xerces.parsers.SAXParser();
parser.parse(some_xml);

to transform some xml.

Normally to set the output method you would use:

<xsl:eek:utput method="xml"/> or <xsl:eek:utput method="html"/>

in the xsl sheet, but in this case (due to problems I'm not going into right now), I need to render as basic html in some cases and true xml in others.

I would like to do something like this:

new org.apache.xerces.parsers.SAXParser(encode_as_html);

or

new org.apache.xerces.parsers.SAXParser(encode_as_xml);

Is that possible in any way?

Or this:

<xsl:if test="//CMSPage/@EditMode = 'true'">
<xsl:eek:utput method="xml" />
</xsl:if>
<xsl:if test="//CMSPage/@EditMode = 'false'">
<xsl:eek:utput method="html" />
</xsl:if>

which I have already tried, but it won't parse.

Any ideas?