  | |  | Mode processing question | Mode processing question 2005-10-12 - By Erin Harris
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" <matei.florescu@(protected)> 10/12/2005 08:49 AM
To xalan-j-users@(protected) 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
<br><font size=2 face="sans-serif">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:</font> <br> <br><font size=2 face="Courier"><xsl:param name="mode" select= "'A'"/></font> <br> <br><font size=2 face="Courier"><xsl:template match="/"></font> <br><font size=2 face="Courier"> <xsl:choose></font> <br><font size=2 face="Courier"> <xsl:when test="$mode='A'"></font> <br><font size=2 face="Courier"> <xsl:apply-templates mode="A"/></font> <br><font size=2 face="Courier"> </xsl:when>< /font> <br><font size=2 face="Courier"> <xsl:otherwise ></font> <br><font size=2 face="Courier"> <xsl:apply-templates mode="B"/></font> <br><font size=2 face="Courier"> </xsl:otherwise ></font> <br><font size=2 face="Courier"> </xsl:choose></font> <br><font size=2 face="Courier"></xsl:template></font> <br><font size=2 face="sans-serif"><br> <br> Erin Harris<br> <br> </font> <br> <br> <br> <table width=100%> <tr valign=top> <td width=40%><font size=1 face="sans-serif"><b>"Matei Florescu" <matei.florescu@(protected)></b> </font> <p><font size=1 face="sans-serif">10/12/2005 08:49 AM</font> <td width=59%> <table width=100%> <tr> <td> <div align=right><font size=1 face="sans-serif">To</font></div> <td valign=top><font size=1 face="sans-serif">xalan-j-users@(protected)< /font> <tr> <td> <div align=right><font size=1 face="sans-serif">cc</font></div> <td valign=top> <tr> <td> <div align=right><font size=1 face="sans-serif">Subject</font></div> <td valign=top><font size=1 face="sans-serif">Mode processing question</font>< /table> <br> <table> <tr valign=top> <td> <td></table> <br></table> <br> <br> <br><font size=2><tt>Hello,<br> <br> I have a XSL stylesheet with templates defined in multiple modes. How can I get<br> Xalan to process templates with single mode in a transformation?<br> Ex. I have templates with mode="A" and mode="B", and I want to apply only those<br> with mode="A".<br> <br> -- <br> Matei Florescu<br> </tt></font> <br>
|
|
 |