Discussion:
[saxon] Could not find function error occured when applying xslt to xml
naveen kumar
2007-08-21 09:26:54 UTC
Permalink
Even though irectified the previous exception by giving valid x path
exception i am getting the below exception

Caused by: javax.xml.transform.TransformerException: Could not find
function: current-group
at org.apache.xalan.processor.XSLTAttributeDef.processEXPR(
XSLTAttributeDef.java:803)
at org.apache.xalan.processor.XSLTAttributeDef.processValue(
XSLTAttributeDef.java:1398)
at org.apache.xalan.processor.XSLTAttributeDef.setAttrValue(
XSLTAttributeDef.java:1589)
at
org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(
XSLTElementProcessor.java:381)
at
org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(
XSLTElementProcessor.java:312)
at org.apache.xalan.processor.ProcessorTemplateElem.startElement(
ProcessorTemplateElem.java:122)
at org.apache.xalan.processor.StylesheetHandler.startElement(
StylesheetHandler.java:668)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(
TransformerFactoryImpl.java:972)

My code is :
\
System.setProperty(
"javax.xml.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");
StreamSource xmlDoc = new StreamSource(new FileInputStream("
catalog.xml"));

//TransformerFactory tFactory = TransformerFactory.newInstance
();
TransformerFactory tFactory= TransformerFactory.newInstance();
StreamSource stylesheet = new StreamSource(new FileInputStream("
style.xsl"));
Transformer transformer = tFactory.newTransformer(stylesheet);

StreamResult result = new StreamResult(new
FileOutputStream("C:/Reports1.xml"));

transformer.transform(xmlDoc,result);
Joe Fawcett
2007-08-21 09:30:32 UTC
Permalink
Well I don't have much experience using Java and XML but it looks like you
are using XSLT 1.0 instead of version 2.0 so the stuff that's supposed to
tell it to use Saxon isn't working as you want.

Joe
Reply-To: Mailing list for SAXON XSLT queries
To: "Mailing list for SAXON XSLT queries"
Subject: [saxon] Could not find function error occured when applying xslt
toxml
Date: Tue, 21 Aug 2007 14:56:54 +0530
Even though irectified the previous exception by giving valid x path
exception i am getting the below exception
Caused by: javax.xml.transform.TransformerException: Could not find
function: current-group
at org.apache.xalan.processor.XSLTAttributeDef.processEXPR(
XSLTAttributeDef.java:803)
at org.apache.xalan.processor.XSLTAttributeDef.processValue(
XSLTAttributeDef.java:1398)
at org.apache.xalan.processor.XSLTAttributeDef.setAttrValue(
XSLTAttributeDef.java:1589)
at
org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(
XSLTElementProcessor.java:381)
at
org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(
XSLTElementProcessor.java:312)
at org.apache.xalan.processor.ProcessorTemplateElem.startElement(
ProcessorTemplateElem.java:122)
at org.apache.xalan.processor.StylesheetHandler.startElement(
StylesheetHandler.java:668)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(
TransformerFactoryImpl.java:972)
\
System.setProperty(
"javax.xml.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");
StreamSource xmlDoc = new StreamSource(new FileInputStream("
catalog.xml"));
//TransformerFactory tFactory = TransformerFactory.newInstance
();
TransformerFactory tFactory= TransformerFactory.newInstance();
StreamSource stylesheet = new StreamSource(new
FileInputStream("
style.xsl"));
Transformer transformer = tFactory.newTransformer(stylesheet);
StreamResult result = new StreamResult(new
FileOutputStream("C:/Reports1.xml"));
transformer.transform(xmlDoc,result);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
saxon-help mailing list
https://lists.sourceforge.net/lists/listinfo/saxon-help
naveen kumar
2007-08-21 09:34:43 UTC
Permalink
my input xml is :

<xsl:stylesheet version="2.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="/technology">
<xsl:for-each-group select="/technology/CATALOG//CD" group-by="COUNTRY">
<xsl:sort select="COUNTRY"/>
<COUNTRY name="{COUNTRY}">
<xsl:for-each-group select="current-group()" group-by="YEAR">
<YEAR year="{YEAR}">
<xsl:copy-of select="current-group()/TITLE"/>
</YEAR>
</xsl:for-each-group>
</COUNTRY>
</xsl:for-each-group>
</xsl:template>
</xsl:stylesheet>

this xslt is 2.0 bcz for-each-group is new feature in xslt 2.0
Post by Joe Fawcett
Well I don't have much experience using Java and XML but it looks like you
are using XSLT 1.0 instead of version 2.0 so the stuff that's supposed to
tell it to use Saxon isn't working as you want.
Joe
Reply-To: Mailing list for SAXON XSLT queries
To: "Mailing list for SAXON XSLT queries"
Subject: [saxon] Could not find function error occured when applying xslt
toxml
Date: Tue, 21 Aug 2007 14:56:54 +0530
Even though irectified the previous exception by giving valid x path
exception i am getting the below exception
Caused by: javax.xml.transform.TransformerException: Could not find
function: current-group
at org.apache.xalan.processor.XSLTAttributeDef.processEXPR(
XSLTAttributeDef.java:803)
at org.apache.xalan.processor.XSLTAttributeDef.processValue(
XSLTAttributeDef.java:1398)
at org.apache.xalan.processor.XSLTAttributeDef.setAttrValue(
XSLTAttributeDef.java:1589)
at
org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes
(
XSLTElementProcessor.java:381)
at
org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes
(
XSLTElementProcessor.java:312)
at org.apache.xalan.processor.ProcessorTemplateElem.startElement(
ProcessorTemplateElem.java:122)
at org.apache.xalan.processor.StylesheetHandler.startElement(
StylesheetHandler.java:668)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch
(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(
TransformerFactoryImpl.java:972)
\
System.setProperty(
"javax.xml.TransformerFactory",
"net.sf.saxon.TransformerFactoryImpl");
StreamSource xmlDoc = new StreamSource(new FileInputStream("
catalog.xml"));
//TransformerFactory tFactory =
TransformerFactory.newInstance
();
TransformerFactory tFactory= TransformerFactory.newInstance
();
StreamSource stylesheet = new StreamSource(new
FileInputStream("
style.xsl"));
Transformer transformer = tFactory.newTransformer
(stylesheet);
StreamResult result = new StreamResult(new
FileOutputStream("C:/Reports1.xml"));
transformer.transform(xmlDoc,result);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
saxon-help mailing list
https://lists.sourceforge.net/lists/listinfo/saxon-help
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
saxon-help mailing list
https://lists.sourceforge.net/lists/listinfo/saxon-help
Andrew Welch
2007-08-21 09:36:36 UTC
Permalink
Post by naveen kumar
Even though irectified the previous exception by giving valid x path
exception i am getting the below exception
Caused by: javax.xml.transform.TransformerException: Could
not find function: current-group
at
org.apache.xalan.processor.XSLTAttributeDef.processEXPR(XSLTAttributeDef.java:803)
at
org.apache.xalan.processor.XSLTAttributeDef.processValue(XSLTAttributeDef.java:1398)
at
org.apache.xalan.processor.XSLTAttributeDef.setAttrValue(XSLTAttributeDef.java:1589)
at
org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(XSLTElementProcessor.java:381)
at
org.apache.xalan.processor.XSLTElementProcessor.setPropertiesFromAttributes(XSLTElementProcessor.java:312)
at
org.apache.xalan.processor.ProcessorTemplateElem.startElement(ProcessorTemplateElem.java:122)
at
org.apache.xalan.processor.StylesheetHandler.startElement(StylesheetHandler.java:668)
at
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown
Source)
at
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at
org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
at
See my response to your previous question - basically your using Xalan
which is an XSLT 1.0 processor and so doesn't understand XSLT 2.0's
current-group()

How can I tell you're using Xalan just from the stack trace? Because
if you look at the stack trace, it says "org.apache.xalan.processor" a
lot.
--
http://andrewjwelch.com
naveen kumar
2007-08-21 09:44:19 UTC
Permalink
thnax fr u r reply Mr. Andrew Welch.

Ya u r correct that xalan is 1.0. although i am setting system property to
SAxon it will poiting to
xalan. moreover jdk internally contains xalan api. i have tried all means
such as directly using saxon
transformerfactoryimpl to create transformer. even though i am getting the
same exception.

k anywway thnx a ton for u r prompted response.
Martin Honnen
2007-08-21 11:32:21 UTC
Permalink
Post by naveen kumar
Ya u r correct that xalan is 1.0. although i am setting system property
to SAxon it will poiting to
xalan. moreover jdk internally contains xalan api. i have tried all
means such as directly using saxon
transformerfactoryimpl to create transformer. even though i am getting
the same exception.
Make sure you use Saxon 8.9.0.4 which you can find here:
<http://sourceforge.net/project/showfiles.php?group_id=29872>
I think there was a problem in the early 8.9.0 releases so that JAXP
APIs don't work as they should.
--
Martin Honnen
http://JavaScript.FAQTs.com/
Loading...