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

RE: Easy one! variables & documents)

Subject: RE: Easy one! variables & documents)
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Wed, 30 Apr 2003 15:29:48 -0600
easy martinez
> From: Karl J. Stubsjoen [mailto:karl@xxxxxxxxxxxxx]
> Sent: Wednesday, April 30, 2003 3:07 PM
> Subject:  Easy one! variables & documents)
> 
> 
> I am reading an external xml document into a variable at the 
> very top of my
> stylesheet (is this legal?)... later I loop through this 
> document.. but I
> don't know how to access the variable in a select statement 
> (it doesn't like
> the $ in the select statement).  Here's the code:
> 
> <xsl:variable name="xmTmplt"><xsl:copy-of
> select="document('usr_member.xml')//FLDS"/></xsl:variable>

This creates $xmTmplt as a result tree fragment.  Any time the contents of
xsl:variable contain a template-body, you get an RTF, which cannot be used
in XPath expressions as anything but a string unless you use the node-set()
extension function.

A much better way to construct this variable is to use:

<xsl:variable name="xmTmplt" select="document('usr_member.xml')//FLDS"/>

That's still very expensive, especially if it's a large document, but it
will return the desired node-set and you won't have to resort to extension
functions, even though node-set() is supported by nearly all XSLT
processors.

hth,
b.

| brian martinez                           brian.martinez@xxxxxxxxxxx |
| lead gui programmer                                    303.708.7248 |
| cheap tickets, part of trip network                fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| cendant travel distribution services   http://www.cheaptickets.com/ |

 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.