[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
> > 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|