[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: Var references in "match" attribute of xsl:template?
From: dkarr@xxxxxxxx (David M. Karr)
Date: 10 Nov 2000 12:05:37 -0800
xsl template match pattern reference
>>>>> "Jeni" == Jeni Tennison <mail@xxxxxxxxxxxxxxxx> writes:
  Jeni> David,

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

  Jeni> However, I note from your description that:

  >> The name of the root tag element is exactly the same as the domain
  >> class.

  Jeni> By 'root tag element' I guess you mean the document element: the
  Jeni> element at the very top of the document tree.  If that's the case,
  Jeni> then you can always get the name of that element through the XPath:

  Jeni>   name(/*) [or local-name(/*) if you're using namespaces]

  Jeni> i.e. the name of the element that is a child of the root node.  You
  Jeni> *can* use this expression within the match pattern of a template.

  Jeni> You can also match on the document element (the element representing
  Jeni> your domain class) with the match pattern:

  Jeni>   /*

Thanks.  Based on this advice, I found I can avoid encoding the name
of the domain class in the XSL completely, by using a top-level match
spec of "/*" and in the template set my "domainClass" variable from
"name()".

-- 
===============================================================================
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:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.