v7.0 - Only xsl:when and xsl:otherwise are allowed here

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Franck
Posts: 35
Joined: Fri Jun 03, 2005 11:00 am

v7.0 - Only xsl:when and xsl:otherwise are allowed here

Post by Franck »

Oxygen 7.0 keeps claiming that there is a problem with the following XSL fragment:

<test>
<xsl:choose>
<xsl:when test="//DocumentType = 'CSCNOTE' ">CSC Note</xsl:when>
<xsl:when test="//DocumentType = 'CSCREQUEST' ">CSC Request</xsl:when>
<xsl:otherwise><xsl:value-of select="//DocumentType"/> </xsl:otherwise>
</xsl:choose>
</test>

Apparently:

"Only xsl:when and xsl:otherwise are allowed here"

I can fix the problem by removing all the indentations, but, as far as I know, an indented xsl:choose is correct. I have checked the DTD, and tried to add the xml:space attribute, but that didn't help.

Am I doing something wrong, or should the XSD/DTD used by Oxygen be amended?
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Hi Franck,

I pasted the provided code snippet into a template body of a stylesheet and cannot find any validation problems with it.
Can you provide us with a small stylesheet in which the problem is reproduced?

Regards, Radu.
Franck
Posts: 35
Joined: Fri Jun 03, 2005 11:00 am

xml:space="preserve"

Post by Franck »

Radu,

I am no longer sure this is an error:
the validation error only occurs when I have xml:space="preserve" on the template (or the node)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8"/>
<xsl:template match="/">
<test xml:space="preserve">
<xsl:choose>
<xsl:when test="true()">True</xsl:when>
<xsl:otherwise>False</xsl:otherwise>
</xsl:choose>
</test>
</xsl:template>
</xsl:transform>

I am not sure if this actually an error, as with xml:space="preserve", the indentations are indeed text nodes, wich appear within the xsl:choose, and therefore are indeed invalid content.
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Hi Franck,

Version 1.0 stylesheets are in Oxygen validated by default with Saxon 6.
As far as we can see this processor considers that white spaces are prohibited in xsl:choose although it should silently ignore them because xsl:choose has element-only content. We will file a report to Michael Kay about the processor's problem.
In the meantime, you can try one of the following:
1) Choose Xalan as the stylesheet validator from Options-> Preferences->XML->XSLT/FO/XQuery->Engine used for XSLT validation and also choose Xalan as the transformer for your stylesheet's related scenarios.
2) Change the stylesheet's version to 2.0. This will automatically change the validator to Saxon 8 and also choose Saxon 8 as the transformer for your stylesheet's related scenarios.

Regards, Radu.
Franck
Posts: 35
Joined: Fri Jun 03, 2005 11:00 am

thanks

Post by Franck »

I'm a Xalan user, so I'll switch to Xalan (I thought I had already) for the validation.

One of the beauty (among many) of oxygen is that it allows me to run the exact same processing than my own application, without the burden of going through an entire request/Response round trip.

This has saved me so much time already that I probably owe you lot a round of beers.

Anyway, thanks for checking that for me.

Best regards

Franck
Post Reply