RE: [xsl] Generate list of XSL Stylesheets from XML root node

Subject: RE: [xsl] Generate list of XSL Stylesheets from XML root node
From: "Jim Fuller" <jim.fuller@xxxxxxxxxxxxxx>
Date: Sun, 8 Feb 2004 20:15:32 -0000
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> kakridge@xxxxxxxxxxxxx
> Sent: 08 February 2004 19:42
> Subject: [xsl] Generate list of XSL Stylesheets from XML root node

> I realize part of my problem is specific to .NET, so I will 
> only focus on the XML/XSLT portion.  Let's say that I have 
> one xml file that can be used by 10 different stylesheets to 
> generate different reports.  Right now I am giving the user 
> 20 different stylesheet selections, 10 of which will not work 
> with the specific data.  I want to only list the 10 reports 
> that work.  Is there a way for me to match the root node with 
> a specific stylesheet?  For instance, if my XML root node is 

Of course, why not use xsl:apply-templates ? Your different stylesheets
can all be included or imported into your 'main; stylesheet.

> <ArrayOfClassRoster>, is there an element I can create in the 
> XSL that I can check to see in order to determine if it can 
> be run with this XML?

Not sure what u mean, but u can always do

<xsl:apply-templates select="ArrayOfClassRoster"/>

Then use 

<xsl:template match="ArrayOfClassRoster">

	Do something.....


That way the existance of a particular element or root node would only
get processed if the <xsl:template match=""/> is present, this sort of
thing is a fundamental tenat to xslt processing.

> My thought is to loop through all of my stylesheets and 
> return all matches to the xml root node.  If anyone has a 
> better way of dynamically matching the xml to xsl, I would 
> appreciate it.  I thought of using a db, but I don't want the 

my head is hurting trying to understand what u mean. Perhaps you are
thinking procedurally, that is looping through your processing code to
match the data, whereas in xslt you tend to let the data lead the
processing. Perhaps you have distinct stylesheets that you wish to apply
in whole, w/o an example not quite sure.

Gl, Jim Fuller

 XSL-List info and archive:

Current Thread