Subject: Re: [xsl] apply template From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 24 Aug 2004 15:00:59 +0100 |
Hi Jan, > <xsl:template match="/"> > <div class="Blog"> > <xsl:for-each select="myns:Blog/myns:Entry"> > <xsl:apply-templates/> > </xsl:for-each> > </div> > </xsl:template> When you have <xsl:apply-templates> with no select attribute it's the same as having: <xsl:apply-templates select="child::node()" /> So you are iterating over each of the <Entry> elements with the <xsl:for-each> and applying templates to their *children*, skipping the other template in your stylesheet. You don't have a template for any of the elements that are children of the <Entry> elements, so the built-in templates are used. The built-in templates essentially give you the string value of the elements that you apply templates to, so you get the string value of all the children of the <Entry> elements. What you wanted to do was apply templates to the <Entry> elements, so do: <xsl:template match="/"> <div class="Blog"> <xsl:apply-templates select="myns:Blog/myns:Entry" /> </div> </xsl:template> or: <xsl:template match="myns:Blog"> <div class="Blog"> <xsl:apply-templates select="myns:Entry" /> </div> </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] apply template, Wendell Piez | Thread | RE: [xsl] apply template, Vasu Chakkera |
Re: [xsl] apply template, Bruce D'Arcus | Date | Re: [xsl] Variable scope when using, Ralph Holz |
Month |