Hi all,

I'm having difficulty getting an XSL to run on Xalan-j 2.7.0

Some template rules need to apply for all or multiple modes, but Xalan isn't 
accepting it.

Using #all or #default triggers a Transformer.transform()-time error """ Valeur 
incorrecte : #default utilisée pour l'attribut QNAME : mode """

Using a whitespace-separated list of modes triggers a TransformerFactory. 
newTransformer()-time exception with:
""" An attribute whose value must be a QName or whitespace-separated list of 
QNames had the value '(( insert my mode here ))'' """

I have written a minimal test to reproduce the problem:

(( java
Transformer trans = TransformerFactory.newInstance().newTransformer(
        new StreamSource("trans.xslt") );
trans.transform(new StreamSource("simple.xml"),
        new StreamResult(System.out));
))

(( xsl
<?xml version="1.0" encoding="iso-8859-15"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:fn="http://www.w3.org/2005/xpath-functions";>
        <xsl:output method="text" version="1.0" encoding="iso-8859-15" 
indent="yes"/>
        
        <xsl:template match="/">
                foo
                <xsl:apply-templates mode="aaaa"/>
        </xsl:template>
        
        <xsl:template match="test" mode="aaaa bbbb">bar</xsl:template>
</xsl:stylesheet>
))

Is this not supported, or am I missing something?

Citing http://www.w3.org/TR/xslt20/#modes :
A template rule is applicable to one or more modes. The modes to which it is 
applicable are defined by the mode attribute of the xsl:template element. If 
the attribute is omitted, then the template rule is applicable to the default 
mode. If the attribute is present, then its value must be a non-empty 
whitespace-separated list of tokens, each of which defines a mode to which the 
template rule is applicable. Each token must be one of the following:

    * a QName, which is expanded as described in 5.1 Qualified Names to define 
the name of the mode
    * the token #default, to indicate that the template rule is applicable to 
the default mode
    * the token #all, to indicate that the template rule is applicable to all 
modes (that is, to the default mode and to every mode that is named in an 
xsl:apply-templates instruction or xsl:template declaration anywhere in the 
stylesheet).


TIA,
Jonathan Winterflood


This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.


Reply via email to