Subject: Re: [xsl] Shorthand. From: Steve <subsume@xxxxxxxxx> Date: Wed, 25 Jul 2007 15:15:44 -0400 |
Oh believe me nobody is more aware of the limitations of XSL 1.0 than I am. However, I'm not going to move my web application from Classic ASP to .NET to use Saxon (much as I despise 1.0).
Yeah, my template works perfectly fine but I was just hoping for something more akin a 1.0 version of Angela's 2.0 solution, for pure style and type-ability reasons. If I could just magically go:
I can't really use apply-templates (a la Grand Mr. Welch) because I'm not transforming links with XSL, I'm generating them.
One of the drawbacks of using XSLT 1.0 is its verbosity. If you are using this server side, you can replace your XSLT processor with an XSLT 2.0 compliant one (there's a .NET version of Saxon and Gestalt available, and a recent mail on this list revealed that the AltovaXML (free, contains xslt 2.0 compliant processor) can also be called from .NET apps).
If you can't upgrade for any reason (though only few reasons should exist against upgrading ;) and when you locked yourself in with MSXML anyway, you can use JScript for any functions you would like to create.
Your example does not enlighten what was unclear from your first examples: why you actually need a named template. The way you show it above perfectly fits for inlining. It depends on the way you pass the parameters, or how you organized the rest of your stylesheet whether you need the verbosity of named templates and/or with-params or not.
On the other side, this *is* the way to create function-like behavior, but be aware of the pitfall to use it too often and make your stylesheet look as if you wrote an imperative / procedural program (meaning: in many occasions, named templates can be replaced by matching templates, possibly with modes).
The only way to really help you here, is when you show more about the context how you are using it.
Cheers, -- Abel Braaksma
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Shorthand., Abel Braaksma | Thread | Re: [xsl] Shorthand., Abel Braaksma |
Re: [xsl] Shorthand., Steve | Date | Re: [xsl] Shorthand., Dimitre Novatchev |
Month |