[ http://issues.apache.org/jira/browse/XALANJ-2088?page=comments#action_61921 ] Mukul Gandhi commented on XALANJ-2088: --------------------------------------
Hello Mr. Bertoni, Thanks for your response.. Here is a small program illustrating your idea. mode.xml -------- <root>1</root> mode.xsl -------- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="yes" /> <xsl:template match="/"> <xsl:apply-templates select="." mode="m" /> </xsl:template> </xsl:stylesheet> I invoke Xalan like this: java org.apache.xalan.xslt.Process -in mode.xml -xsl mode.xsl The output is: 1 So it is sure, that Xalan does have this built in rule .. <xsl:template match="/" mode="m"> <xsl:apply-templates mode="m"/> </xsl:template> The XSLT 1.0 spec says: <quote> The following shows the equivalent of the built-in template rule for mode m. <xsl:template match="*|/" mode="m"> <xsl:apply-templates mode="m"/> </xsl:template> </quote> I think above statement from spec is "referring to non-default mode" for root node. In my above example, this call: <xsl:apply-templates select="." mode="m" /> is calling(or resolving to) the built-in rule - <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> i.e. to a template rule in default mode! or we can say: a mode "m" rule is resolving to a "default mode" rule.. This mapping seems odd to me.. Or is it the right behaviour? The mode "m" is never available to the stylesheet (in the above example). But the processor is able to resolve the call <xsl:apply-templates select="." mode="m" /> So I think logically Xalan must provide a means to supply an initial mode to stylesheet! I cannot find in spec the behaviour in this regard. So it seems a proprietary implementation by Xalan (which seems not quite logical to me)! I would not call it non-conformance.. But my logic makes me think, a XSLT processor must provide means to supply a initial mode to the stylesheet ;) Please do correct me on any of the points! Regards, Mukul > Passing initial mode from command line > -------------------------------------- > > Key: XALANJ-2088 > URL: http://issues.apache.org/jira/browse/XALANJ-2088 > Project: XalanJ2 > Type: Improvement > Components: Xalan-CmdLine > Versions: 2.6 > Environment: Windows 2000 Prof, Xalan-J 2.6.0, JRE 1.4.2_03 > Reporter: Mukul Gandhi > Priority: Minor > > Hello, > For this problem, I need to compare Xalan-J with Saxon and MSXSL. Both Saxon > and MSXSL allow an initial mode to be passed to the transformation. Saxon has > option -im , and MSXSL has option -m . That is we should be able to define a > template rule for root node with a particular mode. > i.e. , as > <xsl:template match="/" mode="x"> > <!-- --> > </xsl:template> > This template rule does not give syntax error with Xalan(it should'nt as it > is a valid rule according to XSLT 1.0 grammer). But we cannot invoke it from > command line.. As Xalan command line does not have option to pass initial > mode. > We can only invoke template rules with default mode , i.e. > <xsl:template match="/"> > <!-- --> > </xsl:template> > The XSLT 1.0 spec explicitly says (section "5.8 Built-in Template Rules").. > <quote> > The following shows the equivalent of the built-in template rule for mode m. > <xsl:template match="*|/" mode="m"> > <xsl:apply-templates mode="m"/> > </xsl:template> > </quote> > This gives impression that the template rule for root node in an initial mode > exists. So the XSLT processor should provide an option to pass initial mode > to the transformation.. > But I cannot find anywhere in spec that this is a mandatory requirement(i.e. > passing initial mode). So I have not called this a bug, but as a "improvement > request" .. > Xalan might be providing this feature. But I am not aware about it.. If it > does, then I am sorry. > Regards, > Mukul -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
