[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: round-robin template call
Hello, I'm not sure I understand your requirements, but the context is available to named templates, so you may use information from the source file at the point where the named template is called, as an input for a test in the named template. For example, this XSLT: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <root> <xsl:apply-templates/> </root> </xsl:template> <xsl:template match="*"> <element name="{name()}"> <xsl:call-template name="test"/> <xsl:apply-templates/> </element> </xsl:template> <xsl:template name="test"> <xsl:choose> <!-- is there an element named 'a' as a direct child of the context node? --> <xsl:when test="a"> <case no="1"/> </xsl:when> <xsl:when test="b"> <case no="2"/> </xsl:when> <xsl:otherwise> <case no="other"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> applied to this source document: <root> <a> <b> <c> <a/> </c> </b> </a> </root> outputs this: <root> <element name="root"> <case no="1"/> <element name="a"> <case no="2"/> <element name="b"> <case no="other"/> <element name="c"> <case no="1"/> <element name="a"> <case no="other"/> </element> </element> </element> </element> </element> </root> Also see this for example: www.zvon.org/xxl/XSL-Ref/Tutorials/Named-Templates/nt2.html HTH Regards, EB > -----Original Message----- > From: Aragon Gouveia [mailto:aragon@xxxxxxxxxxx] > Sent: Sunday, April 05, 2009 7:10 PM > > I want to avoid passing parameters during the template call.
|
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
|