You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Laurent GALY <lg...@cr2a-di.fr> on 2001/09/03 10:18:15 UTC

using in Xalan-J 1

My configuration :

Xerces-J 1.3.1
Xalan-J 1.2.2
Jdk 1.3.1
Windows NT 4.0

  I'm trying to use KEY in my XSLT file and do
the transform with basic usage pattern in my Java file
which transform an InputSource using a transformation.

And I get an error in my XSLT file (ListOfR.xsl) when using key() function.

  So, is there any special thing to do to use KEY (feature, property...) ? In Xerces parser or
in Xalan transformer?

Java file:

public QueryEditor(InputSource in)
{
DOMParser parser = new DOMParser();
parser.parse(in);
Document doc = parser.getDocument();
XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
XSLTInputSource xmlSource = new XSLTInputSource(doc);
XSLTInputSource xslSheet = new XSLTInputSource("files/xsl/ListOfR.xsl");
Document out = new DocumentImpl();
XSLTResultTarget xmlResult = new XSLTResultTarget(out);
processor.process(xmlSource, xslSheet, xmlResult);
}

XSLT file:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output version="1.1" method="xml" omit-xml-declaration="no"
     encoding="iso-8859-1" indent="yes"/>
<xsl:strip-space elements="*"/>

<!-- parameter : name of class -->
<xsl:param name="NAME">jDocume</xsl:param>

<!-- KEY -->
<xsl:key name="rel" match="Relation" use="left/@dbname|right/@dbname"/>
<xsl:key name="class" match="Class" use="@dbname"/>

<xsl:template match="/">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="Model">
  <xsl:element name="root">
    <!-- select class NAME -->
    <xsl:apply-templates select="key('class', $NAME)"/>   <!-- I get the error when processing this line -->
  </xsl:element>
</xsl:template>

<xsl:template match="Class">
  <xsl:element name="{@dbname}"/>
</xsl:template>

</xsl:stylesheet>

The error (full lines in log2 attached file):

java.lang.NoSuchMethodError
	at org.apache.xalan.xpath.xdom.XercesLiaison.getParentOfNode(XercesLiaison.java:457)


Regards,

 

--------------------------------------------------------------
Laurent GALY                            Transiciel Sud-Ouest
tél.: +33 (0)5 62 47 50 41           Agence Industrie
mél.: lgaly@cr2a-di.fr