|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: apply template
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/
|
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
|

Cart








