|
Subject: Re: [xsl] Trouble creating a table with multiple named templates From: Max Bronsema <max.bronsema@xxxxxxxxx> Date: Tue, 3 May 2005 11:27:32 -0600 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Trouble creating a table , JBryant | Thread | Re: [xsl] Trouble creating a table , JBryant |
| [xsl] Alternative to msxsl:node-set, Maria Amuchastegui | Date | Re: [xsl] XPATH total count of mult, Wendell Piez |
| Month |