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(NodeListExpression.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(LiteralResultElement.java:281)
at
com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:630)
at
com.icl.saxon.style.XSLGeneralVariable.getSelectValue(XSLGeneralVariable.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/style: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:master-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