What are you talking about Tod ;-) That's crazy talk. XSLT is much more fun if you actually write lots of templates. If you need to add boilerplate code it's easy enough to do something like this:

<xsl:template match="/">
  <!--add html headers or whatever-->
  <xsl:apply-templates/>
  <!--add html footers or whatever-->
</xsl:template>

then if you want to kill off certain nodes that you're not using it's easy enough:

<xsl:apply-templates match="dontwantthis"/>

Having the default rule I think is useful as a double-check, so that if I get extraneous text output it's a red flag that I goofed somewhere.

simon

On Tuesday, August 5, 2003, at 03:01 PM, Tod Harter wrote:

What I meant was, you're right, but I've brainwashed myself so bad with my
cookie cutter approach ;o) that I forget the rules... Really, XSLT (at least
for my purposes) should just ignore anything that there isn't an explicit
match for. I always put in a 'do nothing' and then just run an open apply
templates loop at the top to get that behaviour, which is 99.99% of the time
what you want when building web pages. I guess XSLT is showing its roots, not
surprising given the terminology they use (stylesheet??? its a PROGRAM
guys!).


So the original post is correct in general, though in my little cozy world my
way works too.

Sorry, should be <xsl:apply-templates/> not <xsl:copy-of .../> sigh.


Sorry, but this is wrong. With your experience, you surely know that
copy-of copies a whole subtree, and nothing in your template continues
processing, so you would bypass most other template rules. Just imagine a
XML snippet <a><b><c/></b></a>. A match on "a" would work, a match on "c"
would not, as the XSLT processor would never get that far.

-- Giant Electronic Brain Internet/E-Commerce Consulting Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-- anti-spam: do not post this address publicly www.simonwoodside.com -- 99% Devil, 1% Angel


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to