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

Re: Trouble creating a table with multiple named temp

Subject: Re: Trouble creating a table with multiple named templates
From: Max Bronsema <max.bronsema@xxxxxxxxx>
Date: Tue, 3 May 2005 11:27:32 -0600
table max
Hi Jay,

Your project sounds intense. Pretty cool. I really like working the
reccommended way as I have found it to eliminate problems down the
road. The for-each method does work except that it does all those
elements at once. Is there a way to exit the for-each statement? I
like the idea of apply-templates though. That would keep me away from
the for-each and make my code simpler for others to read.

<xsl:template match="/">
  <html>
	  <title>Directory</title>
    <body>
      <xsl:apply-templates/>
    </body>
  </html>
</xsl:template>

Is that what you are talking about with <xsl:apply-templates/>

The structure is really no more complex then what I have shown before
and what you have listed below. It was 3 seperate XML files, but I
merged them into 1 using ASP. When I include the
<xsl:apply-templates/> and use the stylesheet you provided earlier,
the XSL still does not walk through the XML file. I am going to be out
the rest of the day so no big hurry in a reply. Thanks again Jay and
to any one else who may contribute while I am away. I am getting a
book tommorrow too, so hopefully not as many silly questions. :)

Max Bronsema

> Assuming that you have many <directory> elements within some parent
> element (I'll call it directories for demonstration purposes), you might
> try a for-each kind of solution. So, if your source XML looks like this:
>
> <directories>
>   <directory>
>     <!-- The structure you showed us earlier here -->
>   </directory>
>   <directory>
>     <!-- The structure you showed us earlier here -->
>   </directory>
>   <!-- and so on many times -->
> </directories>
>
> Then you could do something like this:
>
> <xsl:template match="directories">
>   <table>
>     <xsl:for-each select="directory">
>       <!-- Reach down the tree to get the bits you need to insert as rows
> -->
>     </xsl:for-each>
>   </table>
> </xsl:template>
>
> Mind you, <xsl:apply-templates/> would work just fine here and be
> preferred (match and apply is XSLT's natural processing model), but I'm
> guessing you have additional complexity that might make for-each more
> workable.

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.