xsl-list
[Top] [All Lists]

RE: xsl:key may not contain references to variables

2003-02-17 16:49:33
  I thought this should have been a popular question,
but somehow I did not find it in the archive.
  I am in the process of upgrading from Saxon 6.0.2 to
the latest 6.5.2.  While doing regression testing, I
found compile errors "xsl:key may not contain
references to variables".  Guess the newer version is
more tightly following the specs.

I'm surprised that this ever worked, but 6.0.2 is a long time ago.

  I can expand the variables so that it no longer use
variables in both match and use attributes, but it
will make the code less-readable and more difficult to 
maintain.  Anyone had similar problem and had a more elegant solution?

You could skip straight to Saxon 7.4: XSLT 2.0 allows global variables
to appear in key definitions, provided there are no circularities (i.e.,
the variables must not be defined in terms of the key).

For an XSLT 1.0 solution, I think you've identified the only thing
possible.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

  Attached are some of the examples of the variables
and xsl:key currently in my code.

Thanks,
Xiaocun

<!-- Find all lineitems, key on
string(LineItemLotName) to handle 0 or 1
LineItemLotName -->
<xsl:variable name="LineItemLotColumn" 
select="$LineItemHeader/cell[.=saxon:n2v($mapRFQ,'LineItemLotN
ame')]/@column"/>
<xsl:key name="lineitemLotsKey" match="//row[(_at_)row &gt; 
$LineItemHeaderRow and @row &lt; $BidHeaderRow]" 
use="string(cell[(_at_)column=$LineItemLotColumn])"/>


__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day 
http://shopping.yahoo.com

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


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



<Prev in Thread] Current Thread [Next in Thread>