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

RE: How to use Multi-value Variables?

Subject: RE: How to use Multi-value Variables?
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Mon, 17 Jul 2000 10:01:38 +0100
value variable
> I've defined a variable:
> <xsl:variable name="NewDBMS">
>      <Driver>....</Driver>
>      <Server>....</Server>
>      <Owner>.....</Owner>
> </xsl:variable>
> 
> This variable works fine, in that I can take the <xsl:value-of
> select="$NewDBMS/Server" />

If this works, then you're probably using MSXML3, because it relies on the
implicit conversion of a result tree fragment to a node-set. XSLT 1.0
specifically states that the "/" path operator can't be used with a
result-tree-fragment argument.

> The next problem is to build a template that matches all 
> children of Database ... where there is also a child [of] $NewDBMS with
the same 
> name.  It [seems] that an <xsl:template  match=... /> statement does not 
> allow for variables.

Correct, variables can't be used in template rules. This is to prevent
recursion: a global variable declaration might invoke the template, so which
comes first?

The match pattern must be fixed "at compile time", it can't depend in any
way on the source document. It might be possible to achieve what you want
using the name() function, but that doesn't help much because you'd probably
want to compare the name with a variable.

Mike Kay
PS glad you like the book 


 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.