Var references in "match" attribute of xsl:template?

Subject: Var references in "match" attribute of xsl:template?
From: dkarr@xxxxxxxx (David M. Karr)
Date: 09 Nov 2000 09:32:48 -0800
Despite reading tons of articles, although not having read "the book"
yet, I haven't until now actually had an opportunity to build an XSL
stylesheet.  I'm using it to generate HTML, but to display in a Java
JEditorPane, not in a browser.

In this context, I'll probably have several "similar" stylesheets.
I'm trying to build them so that duplicated code and strings are
minimized.  Each stylesheet will represent a "domain class".  Inside
the stylesheet tag content, I set a "domainClass" variable to the name
of the domain class.  Obviously, this is one line that will vary
between each stylesheet.  I use this variable in a couple of places in
the "body" of the main template.

After that I have a simple "xsl:template" which will match the "root"
of the document, and which presents a simple HTML table to list the
attributes and values of an object (from the XML data).  The name of
the root tag element is exactly the same as the domain class.

I vaguely remember I've read that the value of the "match" attribute
of "xsl:template" cannot reference a variable in any way.  If that's
true, then I have to duplicate the domain class name in the
"domainClass" setting, and in the top-level "xsl:template" tag.  It
would be nice if I could define the domain class in a single place,
and reference it in all the places it is used.  Is there any way to do

David M. Karr     ; dkarr@xxxxxxxx  ; w:(425)487-8312 ; TCSI & Best Consulting
Software Engineer ; Unix/Java/C++/X ; BrainBench CJ12P (#12004)

 XSL-List info and archive:

Current Thread