xsl-list
[Top] [All Lists]

RE: XSLT key() - Saxon UnsupportedOperationException

2003-01-17 12:04:23
This is a known bug in Saxon 6.5.2: see
http://sourceforge.net/tracker/index.php?func=detail&aid=601804&group_id
=29872&atid=397617

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

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Philippe Drix
Sent: 17 January 2003 14:44
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] XSLT key() - Saxon UnsupportedOperationException


Hi,
I have a problem with evaluation of key() fonction.

I think my problem is a XSLT problem, not a Saxon bug, but 
here the exception :



java.lang.UnsupportedOperationException: Cannot create 
intensional node-set 
with context dependencies:
class com.icl.saxon.expr.PathExpression:128
         at 
com.icl.saxon.expr.NodeSetIntent.<init>(NodeSetIntent.java:26)
         at 
com.icl.saxon.expr.PathExpression.reduce(PathExpression.java:186)
         at 
com.icl.saxon.expr.PathExpression.enumerate(PathExpression.java:219)
         at 
com.icl.saxon.expr.NodeListExpression.enumerate(NodeListExpres
sion.java:80)
         at com.icl.saxon.style.XSLForEach.process(XSLForEach.java:69)
         at 
com.icl.saxon.style.StyleElement.processChildren(StyleElement.
java:630)
         at com.icl.saxon.style.XSLForEach.process(XSLForEach.java:96)
         at 
com.icl.saxon.style.StyleElement.processChildren(StyleElement.
java:630)
         at 
com.icl.saxon.style.LiteralResultElement.process(LiteralResult
Element.java:281)
         at 
com.icl.saxon.style.StyleElement.processChildren(StyleElement.
java:630)
         at 
com.icl.saxon.style.XSLGeneralVariable.getSelectValue(XSLGener
alVariable.java:235)
         at 
com.icl.saxon.style.XSLVariable.process(XSLVariable.java:89)
         at 
com.icl.saxon.style.XSLStyleSheet.process(XSLStyleSheet.java:626)
         at 
com.icl.saxon.Controller.transformDocument(Controller.java:1065)
         at com.icl.saxon.Controller.transform(Controller.java:939)
         at com.icl.saxon.StyleSheet.processFile(StyleSheet.java:516)
         at com.icl.saxon.StyleSheet.doMain(StyleSheet.java:338)
         at 
com.icl.saxon.StyleSheet.main(StyleSheet.java:63)



The XSLT program is below. I have two XML documents, and a key to 
construct, matching elements coming from these two documents.


<xsl:variable name="styles" select="document( $stylesPathName )"/>

<xsl:key name="groupesdeFieldsParNom"
          
match="$styles/office:document-styles/office:master-styles/sty
le:master-page//text:bookmark-ref/@text:ref-name" 

          use="." />

<xsl:key name="groupesdeFieldsParNom"
          
match="/office:document-content/office:body//text:bookmark-ref
/@text:ref-name" 

          use="." />


<xsl:variable name="theFields">
     <fields>
         <xsl:for-each select="
             
/office:document-content/office:body//text:bookmark-ref/@text:
ref-name[
               generate-id() =
               generate-id(
                  key('groupesdeFieldsParNom', .)[1]
               )
             ]">
             <xsl:copy-of select="parent::*"/>
         </xsl:for-each>

         <xsl:for-each select="
             
$styles/office:document-styles/office:master-styles/style:mast
er-page//text:bookmark-ref/@text:ref-name[
               generate-id() =
               generate-id(
                  key('groupesdeFieldsParNom', .)[1]
               )
             ]">
             <xsl:copy-of select="parent::*"/>
         </xsl:for-each>
     </fields>
</xsl:variable>


I think the problem arises on a call to key(), because the 
context node is 
not already known, while key() needs this context node, to 
know what XML 
tree is to be visited.

I tried some workarounds, without success. I guess I will 
have to find out 
another resolution method, but perhaps there is indeed a 
workaround that I 
have not already thought about.

Any idea ?

Regards -- Ph D




==
Philippe Drix
      ___________
__| OBJECTIVA |___________________
http://www.objectiva.fr
21-23, rue Aristide Briand - 92170 Vanves
tel : +33 1 47 36 60 30
fax : +33 1 47 36 61 93



 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>