[xsl] copying variables and bits of XML databases for XSL processing

Subject: [xsl] copying variables and bits of XML databases for XSL processing
From: "Antoine Quint, Knowscape://" <antoine@xxxxxxxxxxxxx>
Date: Thu, 19 Apr 2001 01:13:13 +0200

I've been toying with this problem for a couple of days and I don't know if
I can be focussed about it anymore. Please tell me if this doesn't make any

I've got a stylesheet called "vars.xsl" where I set variables that reference
XML databases, like that:

  <xsl:variable name="dbWNc"
  <xsl:variable name="dbWNj" select="document('/whats_new/jeans/db.xml')"/>

and so on...

I always import this stylesheet through <xsl:import/>.

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
    <xsl:if test="$collection = 'jeans'"><xsl:copy-of

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)"/>

Anybody knows a way around this? Is this related to my code or the processor
(MSXML 3.0sp1)? I would like to avoid call-templates and with-params as much
as possible. For reference, here's what the "/whats_new/collection/db.xml"
document looks like.

<?xml version="1.0" encoding="iso-8859-1"?>

    <thumb width="158" height="115" weight="5603"/>
    <pop width="482" height="350" weight="30576"/>
    <thumb width="145" height="115" weight="5039"/>
    <pop width="442" height="350" weight="15408"/>

Antoine Quint <antoine@xxxxxxxxxxxxx> -- eXtensible developer
k n o w s c a p e : // venture knowledge agency www.knowscape.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread