This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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
this?

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


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]