Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Stopping at 1st Node set.. how to get it to process two or three [Thread Next] Re: Stopping at 1st Node set.. how to get it to process two or threeTo: NULL Date: 4/22/2008 9:44:00 AM On Apr 22, 10:32 am, Martin Honnen <mahotr...@yahoo.de> wrote: > Danjojo wrote: > > I am still having difficulty understanding why when it finds the > > correct parent node, and say that node-set has 2 children node-sets, > > it is only creating the html for one node-set. I don't know how to get > > it to process all children of the node-set that it finds and I need > > help. > > > <?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="."> > > It is not clear to me what you want to achieve but the original XML you > posted in another thread has one 'menu' root element with one 'category' > child element and you templates above process just that, the > xsl:template match="menu" does an xsl:apply-templates meaning it > processes only the children of the 'menu' element. > If you want to process any children of the 'category' element as well > then you need to put an > <xsl:apply-templates/> > to process all child nodes or an > <xsl:apply-templates select="*"/> > to process all child elements or an > <xsl:apply-templates select="category"/> > to process all 'category' child elements into the xsl:template > match="category". > > -- > > Martin Honnen --- MVP XML > http://JavaScript.FAQTs.com/ Ok let me try again and I will once again post the test xml at the end. When they use the left menu and it has a flyout menu, that means there are children. So when the Click the parent on the first menu level that means we want them to land on a category page where we creat an independent div for EACH child category. As you can see in the example XML this occurs 3 distinct times. 2 times at the Sub category level. And once, at the sub-sub-category level. For now we don't have to worry about a sub-sub-sub potential flyout in future designs... The value that is passed in $paraCatagory for the very first sub menu is "c1_products" This means I am able to "FIND" the category PARENT node-set in the XML. from their I simple want to traverse through all children elements and create div's for them. HOw is this done in XSLT 1.0? Thanks so much. Daniel <?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_products</ 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_products</ 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> | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
