You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Matei Florescu <ma...@schlund.ro> on 2005/10/12 14:49:57 UTC

Mode processing question

Hello,

  I have a XSL stylesheet with templates defined in multiple modes. How can I get
Xalan to process templates with single mode in a transformation?
Ex. I have templates with mode="A" and mode="B", and I want to apply only those
with mode="A".

-- 
Matei Florescu

Re: Mode processing question

Posted by Matei Florescu <ma...@schlund.ro>.
Thank you for your answer. It helps a bit but it's not quite what I was
looking for. I was thinking about something like the initialMode
parameter that one can pass to Saxon for example in order to
process the only a mode from all those defined in the stylesheet.
I tried to find the same feature in Xalan, but with no luck so far.

Matei Florescu


On Wed, 12 Oct 2005 21:07:02 +0300, Erin Harris <eh...@ca.ibm.com> wrote:

> Do you want to be able to change the mode from the command line or from
> Java?  If so you could try something like the following where the
> parameter "mode" can be set through the PARAM command line option or by
> calling Transformer.setParameter(String name, Object value) from Java:
>
> <xsl:param name="mode" select="'A'"/>
>
> <xsl:template match="/">
>     <xsl:choose>
>         <xsl:when test="$mode='A'">
>             <xsl:apply-templates mode="A"/>
>         </xsl:when>
>         <xsl:otherwise>
>             <xsl:apply-templates mode="B"/>
>         </xsl:otherwise>
>     </xsl:choose>
> </xsl:template>
>
>
> Erin Harris
>
>
>
>
>
> "Matei Florescu" <ma...@schlund.de>
> 10/12/2005 08:49 AM
>
> To
> xalan-j-users@xml.apache.org
> cc
>
> Subject
> Mode processing question
>
>
>
>
>
>
> Hello,
>
>   I have a XSL stylesheet with templates defined in multiple modes. How
> can I get
> Xalan to process templates with single mode in a transformation?
> Ex. I have templates with mode="A" and mode="B", and I want to apply only
> those
> with mode="A".
>



-- 
Matei Florescu

Re: Mode processing question

Posted by Erin Harris <eh...@ca.ibm.com>.
Do you want to be able to change the mode from the command line or from 
Java?  If so you could try something like the following where the 
parameter "mode" can be set through the PARAM command line option or by 
calling Transformer.setParameter(String name, Object value) from Java:

<xsl:param name="mode" select="'A'"/>

<xsl:template match="/">
    <xsl:choose>
        <xsl:when test="$mode='A'">
            <xsl:apply-templates mode="A"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:apply-templates mode="B"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>


Erin Harris





"Matei Florescu" <ma...@schlund.de> 
10/12/2005 08:49 AM

To
xalan-j-users@xml.apache.org
cc

Subject
Mode processing question






Hello,

  I have a XSL stylesheet with templates defined in multiple modes. How 
can I get
Xalan to process templates with single mode in a transformation?
Ex. I have templates with mode="A" and mode="B", and I want to apply only 
those
with mode="A".

-- 
Matei Florescu