<xsl:template match="category">
<xsl:if test="(@name=$paraCatagory)">
This means that if you find a category whose @name is not equal to
$paraCatagory, the stylesheet does nothing with that element - in particular
it does not process the children of that category.
What's more,
<xsl:for-each select=".">
is a no-op.
I've no idea what you really want to do, but I suspect that if you encounter
a category with the wrong name, you want to recursively process it's
children. Say
<xsl:template match="category">
<xsl:choose>
<xsl:when test="(@name=$paraCatagory)">
...
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:template>
Michael Kay
http://www.saxonica.com/
-----Original Message-----
From: Dan Acuff [mailto:dacuff(_at_)suresource(_dot_)com]
Sent: 22 April 2008 15:20
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] XSL-T should naturally loop? not grabbing all
the children node-sets..
I do not know what to do next and I need help.
I have developed and Idea that I could loop through all the
category pages make div boxes of the different categories and
show and image and link.
No matter what I try it stops at the first child node-set and
does not do all 2 or 3 or even the sub-sub-categories. Before
I kill 2 more days on this can I get some help.
Here is what I have so far for the XSL followed by the XML.
Help appreciated.
<?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output encoding="iso-8859-1" method="html"/>
<xsl:param name="paraCatagory"/>
<xsl:template match="menu">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="category">
<xsl:if test="(@name=$paraCatagory)">
<xsl:for-each select=".">
<xsl:element name="div">
<xsl:attribute name="class">cat_block</xsl:attribute>
<xsl:element name="div">
<xsl:attribute name="class">cat_module</xsl:attribute>
<xsl:value-of select="category/@display_name"/>
<br/>
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="category/info/link"/>
</xsl:attribute>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="category/info/images/image"/>
</xsl:attribute>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="iso-8859-1"?> <menu
id="menuData"> <!--™ trademark--> <!--® registered-->
<category name="c1_products" display_name="Category One">
<info>
<keyword>C1</keyword>
<link>/category/c1_products</link>
<titletag>C1 Products from our store -
9 Words for best SEO</titletag>
<images>
<image/>
</images>
</info>
<category name="c1_sub1_products"
display_name="sub-Category c1_sub1">
<info>
<keyword>C1SUB1</keyword>
<link>/products/c1_products/c1_sub1_products</link>
<titletag>C1SUB1 Products from our store
- 9 Words for best SEO</titletag>
<images>
<image>/imagesEdp/default_sm.jpg</image>
</images>
</info>
</category>
</category>
<category name="c2_products" display_name="Category Two">
<info>
<keyword>C2</keyword>
<link>/category/c2_products</link>
<titletag>C2 Products from our store -
9 Words for best SEO</titletag>
<images>
<image/>
</images>
</info>
<category name="c2_sub1_products"
display_name="sub-Category c2_sub1">
<info>
<keyword>C2SUB1</keyword>
<link>/products/c2_products/c2_sub1_products</link>
<titletag>C2SUB1 Products from our store
- 9 Words for best SEO</titletag>
<images>
<image>/imagesEdp/default_sm.jpg</image>
</images>
</info>
</category>
<category name="c2_sub2_products"
display_name="sub-Category c2_sub2">
<info>
<keyword>C2SUB2</keyword>
<link>/products/c2_products/c2_sub2_products</link>
<titletag>C2SUB2 Products from our store
- 9 Words for best SEO</titletag>
<images>
<image>/imagesEdp/default_sm.jpg</image>
</images>
</info>
</category>
<category name="c2_sub3_products"
display_name="sub-Category c2_sub3">
<info>
<keyword>C2SUB3</keyword>
<link>/category/c2_products/c2_sub3_products</link>
<titletag>C2SUB3 Products from our store
- 9 Words for best SEO</titletag>
<images>
<image>/imagesEdp/default_sm.jpg</image>
</images>
</info>
<category name="c2_sub_sub1_products"
display_name="sub-sub-Category c2_sub_sub1">
<info>
<keyword>C2SUBSUB1</keyword>
<link>/products/c2_products/c2_sub3_products/c2_sub_sub1_produ
cts</link>
<titletag>C2SUBSUB1 Products
from our store - 9 Words for best SEO</titletag>
<images>
<image>/imagesEdp/default_sm.jpg</image>
</images>
</info>
</category>
<category name="c2_sub_sub2_products"
display_name="sub-sub-Category c2_sub_sub2">
<info>
<keyword>C2SUBSUB2</keyword>
<link>/products/c2_products/c2_sub3_products/c2_sub_sub2_produ
cts</link>
<titletag>C2SUBSUB2 Products
from our store - 9 Words for best SEO</titletag>
<images>
<image>/imagesEdp/default_sm.jpg</image>
</images>
</info>
</category>
</category>
</category>
<category name="c3_products" display_name="Category Three">
<info>
<keyword>C3</keyword>
<link>/products/c3_products</link>
<titletag>C3 Products from our store -
9 Words for best SEO</titletag>
<images>
<image/>
</images>
</info>
</category>
<category name="c4_products" display_name="Category Four">
<info>
<keyword>C4</keyword>
<link>/products/c4_products</link>
<titletag>C4 Products from our store -
9 Words for best SEO</titletag>
<images>
<image/>
</images>
</info>
</category>
<category name="c5_products" display_name="Category Five">
<info>
<keyword>C5</keyword>
<link>/products/c5_products</link>
<titletag>C5 Products from our store -
9 Words for best SEO</titletag>
<images>
<image/>
</images>
</info>
</category>
<category name="c6_products" display_name="Category Six"
display="no">
<info>
<keyword>C6</keyword>
<link>/products/c6_products</link>
<titletag>C6 Products from our store -
9 Words for best SEO</titletag>
<images>
<image/>
</images>
</info>
</category>
</menu>
~~~~~~~~~~~~~~~~~~
Dan Acuff
Developer
SureSource, Inc.
203.922.7546
dacuff(_at_)suresource(_dot_)com
~~~~~~~~~~~~~~~~~~
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--