[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSL-T should naturally loop? not grabbing all the

Subject: RE: XSL-T should naturally loop? not grabbing all the children node-sets..
From: "Dan Acuff" <dacuff@xxxxxxxxxxxxxx>
Date: Tue, 22 Apr 2008 12:36:14 -0400
RE:  XSL-T should naturally loop? not grabbing all the
Here is the way each child-node-set should be formatted.

<div class="cat_block">
<div class="cat_module">
sub-Category c2_sub1
<br/>
<a href="/products/c2_products/c2_sub1_products">
<img src="/imagesEdp/default_sm.jpg"/>
</a>
</div>
</div>

trouble is it stops there when it should also create html code for:

<div class="cat_block">
<div class="cat_module">
sub-Category c2_sub2
<br/>
<a href="/products/c2_products/c2_sub2_products">
<img src="/imagesEdp/default_sm.jpg"/>
</a>
</div>
</div>

and:

<div class="cat_block">
<div class="cat_module">
sub-Category c2_sub3
<br/>
<a href="/category/c2_products/c2_sub3_products"> <!-- category becuase
this one ALSO has sub-node-sets..
<img src="/imagesEdp/default_sm.jpg"/>
</a>
</div>
</div>

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Tuesday, April 22, 2008 12:16 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  XSL-T should naturally loop? not grabbing all the
children node-sets..



perhaps something like

<?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="xml" indent="yes"/>
<xsl:param name="paraCatagory"/>

 <xsl:template match="menu">
  <xsl:apply-templates select="category[@name=$paraCatagory]"/>
 </xsl:template>

 <xsl:template match="category">
   <div class="cat_block">
     <xsl:choose>
       <xsl:when test="parent::menu">
	 <xsl:attribute name="class">cat_block</xsl:attribute>
       </xsl:when>
       <xsl:otherwise>
	 <xsl:attribute name="class">cat_module</xsl:attribute>
       </xsl:otherwise>
     </xsl:choose>
     <xsl:value-of select="category/@display_name"/>
     <br/>
     <a href="info/link">
       <img src="info/images/image"/>
     </a>
     <xsl:apply-templates select="category"/>
   </div>
 </xsl:template>
</xsl:stylesheet>


which makes

$ saxon loop.xml loop.xsl paraCatagory=c2_products <?xml version="1.0"
encoding="iso-8859-1"?> <div class="cat_block">sub-Category c2_sub1<br/>
   <a href="info/link">
      <img src="info/images/image"/>
   </a>
   <div class="cat_module">
      <br/>
      <a href="info/link">
         <img src="info/images/image"/>
      </a>
   </div>
   <div class="cat_module">
      <br/>
      <a href="info/link">
         <img src="info/images/image"/>
      </a>
   </div>
   <div class="cat_module">sub-sub-Category c2_sub_sub1<br/>
      <a href="info/link">
         <img src="info/images/image"/>
      </a>
      <div class="cat_module">
         <br/>
         <a href="info/link">
            <img src="info/images/image"/>
         </a>
      </div>
      <div class="cat_module">
         <br/>
         <a href="info/link">
            <img src="info/images/image"/>
         </a>
      </div>
   </div>
</div>


(I switched xsl:output to use xml indenting, just to make it clearer
what the output is)

David

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.