[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: controller stylsheet. performance, best practices
"Braumüller, Hans" <H.Braumueller@xxxxxxxxxxxx> wrote in message news:EB6EC71285FAC6469C0F41B476F5AAA1026B66@xxxxxxxxxxxxxxxxxxxxxxxxxxx > I cannot figure out how the template xyzPage with mode="switch" is getting involved when i call > > from template match="/" following in my switch.xml parameter p with xyz: > > <xsl:apply-templates > select="document('switch.xml')/switch/*[name()=$p]"> > <xsl:with-param name="current-node" select="."/> > </xsl:apply-templates> > I think Mike meant: <xsl:apply-templates mode="switch" select="document('switch.xml')/switch/*[name()=$p]"> <xsl:with-param name="current-node" select="."/> </xsl:apply-templates> > Then i am in node xyz in switch.xml > > I do not see how template xyzPage with mode="switch" is applied then > ? if there is only one template that matches an "xyzPage" element, it will be instantiated by the code above. The code above achieves instantiating a template dynamically based on the node that is matched by it. The node name itself is passed as a parameter. So, instead of writing an unlimitedly long <xsl:choose> and having to update it with new cases every time a new template is added, the code above does it just in 4 lines -- once and forever. This is the idea -- in case it is not clear there's a more detailed explanation and many, many examples at: http://fxsl.sourceforge.net ===== Cheers, Dimitre Novatchev. http://fxsl.sourceforge.net/ -- the home of FXSL XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|