Re: [xsl] Application using XML

Subject: Re: [xsl] Application using XML
From: "Alistair MacDonald" <AlistairMacDonald@xxxxxxxxxxxxx>
Date: Tue, 03 Apr 2001 14:12:34 +0100
=== daniel.newman@xxxxxxxxxxx 04/03/01 01:23PM ===
>I'm planning on building an Internet application using XML. Now I'm going to
>need an ASP page that gets different XML results (that bit's easy), and also
>gets different XSL files to format the XML (that bit's easy also). BUT, if I
>want to have just one XSL file that interprets the source data and uses the
>relevant part of the XSL file. So if I have a maximum of 10 different result
>(xHTML) pages, can I have one XSL file building them?

Yes, so long as there is a mechanism for identifying the different types - be this different XML or parameters.

> Is it possible from
>the ASP page, to pass variables to the XSL file so it knows which page it's

Probably - but you would need to check the ASP/XSLT integration documentation. The mechanism for passing parameters is undefined by the w3 - they simply provide support in XSLT for it to happen somehow. (<xsl:param ...> at the top level)

>If I need to have 10 XSL files, fine, but thought this might not be the best
>way of doing this. Although having all that extra code in the single XSL
>file might get confusing. What's the best way to go about planning this

Generally start by trying to modularise the code somehow. A lot depends upon the data itself - how similar is the XML? Are all the transforms going to behave similarly?  You may find that after you split the code up into sections that you can build 10 driver files which basically import/include other templates, or you may find that you still prefer to build 1 driver and then call the rest of the templates. I prefer the 10 drivers and then override-any-behaviour-of-the-core-modules-I-don't-like-in-the-driver file approach myself. Its simple, clean and makes variations obvious.


 XSL-List info and archive:

Current Thread