Subject: RE: [xsl] template match for subelement throughout tree From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 15 Apr 2003 15:57:15 -0400 |
May I ask:
The first templates creates a "whee" attribute for each <parent>?
<xsl:template match="parent"> <xsl:apply-templates mode="whee"/> <!-- selects all child nodes for processing (the default); processes them by finding templates to match them and instantiating each template - BUT - only matches templates in mode="whee" --> <xsl:apply-templates/> <!-- does exactly the same, EXCEPT matches templates in no mode --> </xsl:template>
<xsl:template match="child"> <!-- any elements named 'child' can be matched by this template --> <xsl:text>Oo!</xsl:text> <!-- when instantiated, outputs the text 'Oo!' --> </xsl:template>
<xsl:template match="child" mode="whee"> <!-- the same as the last, also matches 'child' elements, except this time in a mode="whee" --> <xsl:text>Whee!</xsl:text> <!-- when instantiated, outputs the text 'Whee!' --> </xsl:template>
<parent> <child/> <child/> <child/> </parent>
Why is the <xsl:apply-templates/> needed after <xsl:apply-templates mode="whee"/>?
Does each <child> end up with Whee! and Oo! ?
Sorry to be dense...brain overload.
<xsl:template match="pet"> <!-- any elements named 'pet' can be matched by this template --> <xsl:text>Woof!</xsl:text> <!-- when instantiated, outputs the text 'Woof!' --> </xsl:template>
<xsl:template match="pet" mode="whee"> <xsl:text>Grrr!</xsl:text> </xsl:template>
<parent> <child/> <pet/> <child/> <child/> <pet/> </parent>
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] template match for subele, Kathy Burke | Thread | RE: [xsl] template match for subele, Kathy Burke |
Re: [xsl] Variable creation and sco, David Carlisle | Date | RE: [xsl] more on Using apply-templ, David Carlisle |
Month |