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

RE: copying variables and bits of XML databases for XS

Subject: RE: copying variables and bits of XML databases for XSL processing
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 11:34:12 +0100
RE:  copying variables and bits of XML databases for XS
>
> One of my stylesheets need to copy one the $dbWNc and $dbWNj
> variables in
> another variable according to which section we're in. Here's
> the code I
> wanted to use:
>
>   <xsl:variable name="current_db">
>     <xsl:if test="$collection = 'collection'"><xsl:copy-of
> select="$dbWNc"/></xsl:if>
>     <xsl:if test="$collection = 'jeans'"><xsl:copy-of
> select="$dbWNj"/></xsl:if>
>   </xsl:variable>
>
> where $collection held the "section" information. This
> doesn't work since
> when I try to access my new variable like this for example, I get an
> "Unspecified error" from MSXML 3.0sp1:
>
> <xsl:variable name="items" select="count($current_db//item)"/>
>
$current_db is a result tree fragment, and you can't use an RTF in a path
expression. One solution is to convert it to a node-set using the
xx:node-set() extension function. Better is to make the variable a node-set
in the first place:

<xsl:variable name="current_db"
  select="$dbWNc[$collection='collection'] |
          $dbWNj[$collection='jeans']"/>

This has the advantage that it avoids the unnecessary and potentially
expensive <xsl:copy-of> .

Mike Kay
Software AG


 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.