This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 184489

Summary: [69cat] XML: Request for XSLT 2.0 and XPATH 2.0 support
Product: xml Reporter: gliesian <gliesian>
Component: XSLAssignee: Svata Dedic <sdedic>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 7.3.1   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: XSLT Panel Options - Example Suggestion

Description gliesian 2010-04-19 17:12:51 UTC
It appears as if NetBeans transformations are XSLT 1.0/XPath 1.0 compliant... and not XSLT 2.0/XPath 2.0.  I have validated this by attempting a XSLT 2.0 transform through a right-click of an XML file followed by "XSL Transformation..." and the appropriate settings.

My request is for NetBeans to use XSLT 2.0 and XPath 2.0 compliant transformations.

I couldn't tell for sure, but it appears as if NetBeans uses the JAXP API which
targets XSLT 1.0.

Actually, taking another look... looks like Xalan (XSLT 1.0 target) is utilized as shown from these validation error:

-- Using com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl - default JRE XSLT processor.
-- Unsupported XSL element 'http://www.w3.org/1999/XSL/Transform:for-each-group'

Notes:

As far as I could tell, Saxon is the only current open-source implementer of XSLT 2.0/XPath 2.0 standards, along with the Altova commericial products.

Some more notes:

---------------------------
- XSLT 2.0 Specification --
---------------------------

XSL Transformations (XSLT) Version 2.0
W3C Recommendation 23 January 2007
http://www.w3.org/TR/xslt20/

---------------------
- TARGETS XSLT 2.0 --
---------------------

Saxon; The XSLT and XQuery Processor
Saxon is an open source product available under the Mozilla Public License. It provides implementations of XSLT 2.0, XQuery 1.0, and XPath 2.0 at the basic level of conformance defined by W3C.

---------------------
- TARGETS XSLT 1.0 --
---------------------

JSR-000206 Java™API for XML Processing
(“Specification”)
Version: 1.4
Maintenance Release
16 August 2006
"This specification supports XSL Transformations (XSLT) Version 1.0"

Xalan-Java Version 2.7.1 
Xalan-Java is an XSLT processor for transforming XML documents into HTML, text, or other XML document types.
It implements XSL Transformations (XSLT) Version 1.0 

XT
XT is an implementation of XSLT 1.0
http://www.blnz.com/xt/xt-20051206/index.html

-------------------
- FORUM QUESTION --
-------------------

Forum question about JAXP and XSLT 2.0:
http://www.stylusstudio.com/SSDN/default.asp?action=9&read=7175&fid=48

-------------------------
- Implementation notes --
-------------------------

XSLT Implementations:
http://www.dpawson.co.uk/xsl/sect1/N303.html
Comment 1 gliesian 2010-04-23 13:52:22 UTC
The ability to directly use XSLT 1.0 and XPath 1.0 implementations, should not be lost when including XSLT 2.0 and XPath 2.0 capabilities in the IDE.
Comment 2 gliesian 2010-05-19 12:28:10 UTC
I pinged a listserver for a list of XSLT 2.0 and XPath 2.0 implementations; http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201005/msg00024.html.  Here's part of the main response:  

>> Can someone please provide me with a list of all XSLT 2.0/XPath 2.0 implementations:

XSLT 2.0/XPath 2.0 vendor implementations
-- Saxon 
-- Altova
-- IBM Websphere
-- Intel SOA Expressway
-- Gestalt (No longer maintained or supported)
-- Mark Logic (possible plans for the future)
-- eXist (possible plans for the future)

-------------------------------------------------------------------

IMHO, I would think that Saxon would be the target.. Thanks.
Comment 3 gliesian 2010-05-19 16:43:49 UTC
From http://xml.netbeans.org/xsl/index.html:

FAQs

How can I use another XSLT Processor?

    XSLT processor it located using JAXP 1.1 mechanism.
    It allows you to change it globally for used JRE.
    I tried Saxon 6.5.2. Installation is pretty easy simply unzip saxon.zip and copy saxon.jar to your jre/lib/ext. Saxon seems to be times faster on XPath operations than default Sun's JRE 1.4.1 XSLT processor or Xalan 2.0.X.

---------------------

As such, perhaps package the libraries with NetBeans... and allow the user to decide which XSLT Transformer to use (e.g., Xalan or Saxon)... NetBeans would provide the dialog box and do the binding behind the scenes.

Thanks.
Comment 4 gliesian 2010-06-05 01:21:23 UTC
Recommended change:

This file: 

http://hg.netbeans.org/main-golden/file/1a5274a9e8fe/xsl/src/org/netbeans/modules/xsl/transform/TransformPerformer.java

needs to be adjusted to use an XSLT 2.0 processor (i.e. Saxon) through JAXP.

IMPORTANT: When the user opens up the transformation dialog, he/she should be presented with which version of XSLT/XPath to use (i.e. 1.0 or 2.0).  This is important as there are some features in 1.0 that are no longer supported in 2.0, so the user must have the option to decide.

NOTE: http://www.stylusstudio.com/SSDN/default.asp?action=9&read=7175&fid=48&style=Inline

Thanks.
Comment 5 gliesian 2010-06-05 01:34:28 UTC
Created attachment 99833 [details]
XSLT Panel Options - Example Suggestion
Comment 6 gliesian 2010-06-05 01:35:19 UTC
I've uploaded a rough image as an example of how the XSLT transformation dialog can support both XSLT 1.0 and XSLT 2.0.

Thanks!
Comment 7 argonym 2013-04-16 17:00:41 UTC
This refers to configuring Saxon as XSLT Processor as mentioned in https://xml.netbeans.org/xsl/.

In addition to copying the saxonXYZ.jar to jre/lib/ext, there is just one step missing for configuring Saxon as the JRE-installation-default XSLT transformer.
In your jre/lib dir create a jaxp.properties file with following content:
javax.xml.transform.TransformerFactory = net.sf.saxon.TransformerFactoryImpl

There are other ways of achieving this. See here: https://jaxp.dev.java.net/1.4/JAXP-FAQ.html#pluggability

If Saxon has been used for an XSL Transformation in Netbeans the XSLT Processor output will contain:
"Using net.sf.saxon.Controller XSLT processor from file ..."

[Tested with NetBeans 7.3.1 / Saxon-HE 9.4.0 / JRE 1.7.0_17]


So it works without changing anything on Netbeans' side. But at least Netbeans XSL Support website should be complemented with this information.
Still, I support the idea of making the used XSLT processor configurable through Netbeans UI and/or even shipping Netbeans with Saxon as default.