xsl-list
[Top] [All Lists]

RE: Can you apply a template match on a copy node?

2002-09-23 03:39:44
Yep looks like css is the best solution. I'm just experimenting really, but there are plenty of scenarios where I have wanted to apply a template to a node written out in another match, so that I can reuse a single style definition.

Example(ish): I have a forum which replaces smilies in message threads.

If all text nodes always go through the text() match I have a single place I can pass smilies into gifs by inserting an image tag. If my generic image match can then be applied to this new image node, then I have one central place where my images can be processed generically, such as appending image directory to the src attribute of any image. It also means one central place where smilie replacement may be turned on/off.

I know there are plenty of other ways of handling these scenarios but the central matches solution is much neater and cleaner, and takes the emphasis away from the template creator having to consider the bigger picture. ie. think about appending variables to attributes etc.

Node-set does the job, but still not sure about whether there are heavy processing penalties for using it, and also the implementation is a bit messy.

From: "Robert Koberg" <rob(_at_)koberg(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: RE: [xsl] Can you apply a template match on a copy node?
Date: Sun, 22 Sep 2002 16:13:24 -0700

Hi,

> Mike Carlisle wrote:
> > Hi Joerg,
> >
> > I'm just experimenting with ways of using xml/xsl. Sure I could use css, but > > I prefer keeping things clean and maintainable from one file. I'm a great > > believer in a clear seperation between data and layout, and the simplier I > > can find ways to control the styling the better, which is why I was hoping
> > to do away with css altogether and use xsl templates for everything.
> >
> > I'm using a server-side asp transform for the processing, so any use of
> > xsl/xml needs to be very efficient to compete with a pure asp scripted
> > solution.
> >
> > Mike
>>

The best (clean, maintainable, simple) separation you could acheive would be by using CSS after making a simple html structure by transforming your XML with
XSLT. Why do you feel this is wrong?

XML     HTML
 + --->  +
XSL     CSS

You can get close to one HTML structure and make completely different looks with
CSS.

Using CSS will also allow you to move much of your server side processing to the
client, which means faster server-side processing.

I do not understand why you would want to avoid CSS. Everything you mention
above would indicate that you should use CSS.

best,
-Rob



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list